Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct { Username string `json:"username"` jwt.StandardClaims }
Claims is a struct that is consumed by the jwt-go that includes the claims that need to be included into a json web token.
type JwtAuth ¶
type JwtAuth struct {
// contains filtered or unexported fields
}
JwtAuth is a struct holding the jwtKey. The key is generated once when starting the middleware.
func NewJwtAuth ¶
NewJwtAuth returns a new JwtAuth struct if the jwt key generation is successful, or an error, if it is not.
func (*JwtAuth) GenerateToken ¶
GenerateToken generates a jwt token. It is the callers job to ensure that the username has been verified in the database first.
func (*JwtAuth) ValidateToken ¶
ValidateToken takes a jwt token string as an argument and returns an error if the validation fails. If the validation is successful, nil is returned
Click to show internal directories.
Click to hide internal directories.