Documentation ¶
Index ¶
- func New(cfg *config.Config, logger lumber.Logger) (core.Session, error)
- type JWTAuthorizer
- func (jw *JWTAuthorizer) Authorize(c *gin.Context) (*core.UserData, error)
- func (jw *JWTAuthorizer) AuthorizeInternal(c *gin.Context) (*core.BuildData, error)
- func (jw *JWTAuthorizer) CreateToken(data *core.UserData) (*http.Cookie, error)
- func (jw *JWTAuthorizer) CreateTokenInternal(data *core.BuildData) (string, error)
- func (jw *JWTAuthorizer) DeleteCookie() *http.Cookie
- type JwtClaims
- func (c *JwtClaims) MarshalJSON() ([]byte, error)
- func (c *JwtClaims) SetCustomClaim(data *core.UserData) error
- func (c *JwtClaims) SetExpiry(timeUnix int64)
- func (c *JwtClaims) SetIssuedAt(timeUnix int64)
- func (c *JwtClaims) SetIssuer(issuer string)
- func (c *JwtClaims) SetJTI(jti string)
- func (c *JwtClaims) Valid() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JWTAuthorizer ¶
type JWTAuthorizer struct {
// contains filtered or unexported fields
}
JWTAuthorizer provides a Json-Web-Token authentication implementation. On failure, a 401 HTTP response is returned.
func (*JWTAuthorizer) Authorize ¶
Authorize vaildates and extracts the data from JWT Token claims from request header
func (*JWTAuthorizer) AuthorizeInternal ¶
AuthorizeInternal parses and validates the internal JWT Token
func (*JWTAuthorizer) CreateToken ¶
CreateToken method that clients can use to create a jwt token and returns the http cookie.
func (*JWTAuthorizer) CreateTokenInternal ¶
func (jw *JWTAuthorizer) CreateTokenInternal(data *core.BuildData) (string, error)
CreateInternalToken creates internal JWT token
func (*JWTAuthorizer) DeleteCookie ¶
func (jw *JWTAuthorizer) DeleteCookie() *http.Cookie
DeleteCookie deletes the cookie.
type JwtClaims ¶
type JwtClaims struct {
jwt.MapClaims
}
JwtClaims - represents the jwt claims
func (*JwtClaims) MarshalJSON ¶
MarshalJSON marshals the MapClaims struct
func (*JwtClaims) SetCustomClaim ¶
SetCustomClaim sets the custom claim in payload
func (*JwtClaims) SetIssuedAt ¶
SetIssuedAt sets expiry in unix epoch secs
Click to show internal directories.
Click to hide internal directories.