Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSignedToken ¶
func GetSignedToken(opts map[string]interface{}, secret interface{}, claims UserClaims) (string, error)
GetSignedToken returns a signed JWT token based on the provided options.
Types ¶
type AccessListClaim ¶
type AccessListClaim struct {
Paths map[string]interface{} `json:"paths,omitempty" xml:"paths" yaml:"paths,omitempty"`
}
AccessListClaim represents custom acl/paths claim
type UserClaims ¶
type UserClaims struct { Audience []string `json:"aud,omitempty" xml:"aud" yaml:"aud,omitempty"` ExpiresAt int64 `json:"exp,omitempty" xml:"exp" yaml:"exp,omitempty"` ID string `json:"jti,omitempty" xml:"jti" yaml:"jti,omitempty"` IssuedAt int64 `json:"iat,omitempty" xml:"iat" yaml:"iat,omitempty"` Issuer string `json:"iss,omitempty" xml:"iss" yaml:"iss,omitempty"` NotBefore int64 `json:"nbf,omitempty" xml:"nbf" yaml:"nbf,omitempty"` Subject string `json:"sub,omitempty" xml:"sub" yaml:"sub,omitempty"` Name string `json:"name,omitempty" xml:"name" yaml:"name,omitempty"` Email string `json:"email,omitempty" xml:"email" yaml:"email,omitempty"` Roles []string `json:"roles,omitempty" xml:"roles" yaml:"roles,omitempty"` Origin string `json:"origin,omitempty" xml:"origin" yaml:"origin,omitempty"` Scopes []string `json:"scopes,omitempty" xml:"scopes" yaml:"scopes,omitempty"` Organizations []string `json:"org,omitempty" xml:"org" yaml:"org,omitempty"` AccessList *AccessListClaim `json:"acl,omitempty" xml:"acl" yaml:"acl,omitempty"` Address string `json:"addr,omitempty" xml:"addr" yaml:"addr,omitempty"` PictureURL string `json:"picture,omitempty" xml:"picture" yaml:"picture,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty" xml:"metadata" yaml:"metadata,omitempty"` }
UserClaims represents custom and standard JWT claims.
func NewUserClaimsFromMap ¶
func NewUserClaimsFromMap(m map[string]interface{}) (*UserClaims, error)
NewUserClaimsFromMap returns UserClaims.
func ParseClaims ¶
func ParseClaims(token *jwtlib.Token) (*UserClaims, error)
ParseClaims extracts claims from a token.
func (UserClaims) AsMap ¶
func (u UserClaims) AsMap() map[string]interface{}
AsMap converts UserClaims struct to dictionary.
func (*UserClaims) GetSignedToken ¶
func (u *UserClaims) GetSignedToken(opts map[string]interface{}) (string, error)
GetSignedToken returns a signed JWT token based on the provided options.
Click to show internal directories.
Click to hide internal directories.