Documentation
¶
Index ¶
- Constants
- type Claims
- type ClaimsContextKey
- type Service
- func (s *Service) AuthMiddleware(next http.Handler) http.Handler
- func (s *Service) GenerateToken(userID string, userName string) (string, error)
- func (s *Service) GenerateTokenAndStore(w http.ResponseWriter, userID string, userName string) error
- func (s *Service) VerifyToken(tokenString string) (*Claims, error)
Constants ¶
View Source
const TokenCookieKey = "session_token"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
jwt.RegisteredClaims
UserID string `json:"user_id"`
UserName string `json:"user_name"`
}
type ClaimsContextKey ¶
type ClaimsContextKey struct{}
type Service ¶
type Service struct {
SecretKey []byte
}
func (*Service) GenerateToken ¶
func (*Service) GenerateTokenAndStore ¶
Click to show internal directories.
Click to hide internal directories.