Documentation ¶
Index ¶
- type AccessListClaim
- type Authenticator
- type Checkpoint
- type Claims
- type User
- func (u *User) AddFrontendLinks(v interface{}) error
- func (u *User) AsMap() map[string]interface{}
- func (u *User) GetClaimValueByField(k string) string
- func (u *User) GetData() map[string]interface{}
- func (u *User) GetRequestHeaders() map[string]string
- func (u *User) GetRequestIdentity() map[string]interface{}
- func (u *User) HasRole(roles ...string) bool
- func (u *User) HasRoles(roles ...string) bool
- func (u *User) SetExpiresAtClaim(i int64)
- func (u *User) SetIssuedAtClaim(i int64)
- func (u *User) SetNotBeforeClaim(i int64)
- func (u *User) SetRequestHeaders(m map[string]string)
- func (u *User) SetRequestIdentity(m map[string]interface{})
- func (u *User) SetRolesClaim(roles []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessListClaim ¶
type AccessListClaim struct {
Paths map[string]interface{} `json:"paths,omitempty" xml:"paths,omitempty" yaml:"paths,omitempty"`
}
AccessListClaim represents custom acl/paths claim
type Authenticator ¶
type Authenticator struct { Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Realm string `json:"realm,omitempty" xml:"realm,omitempty" yaml:"realm,omitempty"` Method string `json:"method,omitempty" xml:"method,omitempty" yaml:"method,omitempty"` TempSecret string `json:"temp_secret,omitempty" xml:"temp_secret,omitempty" yaml:"temp_secret,omitempty"` TempSessionID string `json:"temp_session_id,omitempty" xml:"temp_session_id,omitempty" yaml:"temp_session_id,omitempty"` TempChallenge string `json:"temp_challenge,omitempty" xml:"temp_challenge,omitempty" yaml:"temp_challenge,omitempty"` URL string `json:"url,omitempty" xml:"url,omitempty" yaml:"url,omitempty"` }
Authenticator represents authentication backend
type Checkpoint ¶
type Checkpoint struct { ID int `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` Parameters string `json:"parameters,omitempty" xml:"parameters,omitempty" yaml:"parameters,omitempty"` Passed bool `json:"passed,omitempty" xml:"passed,omitempty" yaml:"passed,omitempty"` FailedAttempts int `json:"failed_attempts,omitempty" xml:"failed_attempts,omitempty" yaml:"failed_attempts,omitempty"` }
Checkpoint represents additional checks that a user needs to pass. Once a user passes the checks, the Authorized is set to true. The checks could be the acceptance of the terms of use, multi-factor authentication, etc.
func NewCheckpoint ¶
func NewCheckpoint(s string) (*Checkpoint, error)
NewCheckpoint returns Checkpoint instance.
func NewCheckpoints ¶
func NewCheckpoints(v interface{}) ([]*Checkpoint, error)
NewCheckpoints returns Checkpoint instances.
type Claims ¶
type Claims struct { Audience []string `json:"aud,omitempty" xml:"aud,omitempty" yaml:"aud,omitempty"` ExpiresAt int64 `json:"exp,omitempty" xml:"exp,omitempty" yaml:"exp,omitempty"` ID string `json:"jti,omitempty" xml:"jti,omitempty" yaml:"jti,omitempty"` IssuedAt int64 `json:"iat,omitempty" xml:"iat,omitempty" yaml:"iat,omitempty"` Issuer string `json:"iss,omitempty" xml:"iss,omitempty" yaml:"iss,omitempty"` NotBefore int64 `json:"nbf,omitempty" xml:"nbf,omitempty" yaml:"nbf,omitempty"` Subject string `json:"sub,omitempty" xml:"sub,omitempty" yaml:"sub,omitempty"` Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Email string `json:"email,omitempty" xml:"email,omitempty" yaml:"email,omitempty"` Roles []string `json:"roles,omitempty" xml:"roles,omitempty" yaml:"roles,omitempty"` Origin string `json:"origin,omitempty" xml:"origin,omitempty" yaml:"origin,omitempty"` Scopes []string `json:"scopes,omitempty" xml:"scopes,omitempty" yaml:"scopes,omitempty"` Organizations []string `json:"org,omitempty" xml:"org,omitempty" yaml:"org,omitempty"` AccessList *AccessListClaim `json:"acl,omitempty" xml:"acl,omitempty" yaml:"acl,omitempty"` Address string `json:"addr,omitempty" xml:"addr,omitempty" yaml:"addr,omitempty"` PictureURL string `json:"picture,omitempty" xml:"picture,omitempty" yaml:"picture,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty" xml:"metadata,omitempty" yaml:"metadata,omitempty"` // contains filtered or unexported fields }
Claims represents custom and standard JWT claims associated with User.
type User ¶
type User struct { Claims *Claims `json:"claims,omitempty" xml:"claims,omitempty" yaml:"claims,omitempty"` Token string `json:"token,omitempty" xml:"token,omitempty" yaml:"token,omitempty"` TokenName string `json:"token_name,omitempty" xml:"token_name,omitempty" yaml:"token_name,omitempty"` TokenSource string `json:"token_source,omitempty" xml:"token_source,omitempty" yaml:"token_source,omitempty"` Authenticator Authenticator `json:"authenticator,omitempty" xml:"authenticator,omitempty" yaml:"authenticator,omitempty"` Checkpoints []*Checkpoint `json:"checkpoints,omitempty" xml:"checkpoints,omitempty" yaml:"checkpoints,omitempty"` Authorized bool `json:"authorized,omitempty" xml:"authorized,omitempty" yaml:"authorized,omitempty"` FrontendLinks []string `json:"frontend_links,omitempty" xml:"frontend_links,omitempty" yaml:"frontend_links,omitempty"` Locked bool `json:"locked,omitempty" xml:"locked,omitempty" yaml:"locked,omitempty"` Cached bool `json:"cached,omitempty" xml:"cached,omitempty" yaml:"cached,omitempty"` // contains filtered or unexported fields }
User is a user with claims and status.
func (*User) AddFrontendLinks ¶
AddFrontendLinks adds frontend links to User instance.
func (*User) GetClaimValueByField ¶
GetClaimValueByField returns the value of the provides claims field.
func (*User) GetData ¶
GetData return user claim felds and their values for the evaluation by an ACL.
func (*User) GetRequestHeaders ¶
GetRequestHeaders returns request headers associated with the user.
func (*User) GetRequestIdentity ¶
GetRequestIdentity returns request identity associated with the user.
func (*User) SetExpiresAtClaim ¶ added in v1.3.22
SetExpiresAtClaim sets ExpiresAt claim.
func (*User) SetIssuedAtClaim ¶ added in v1.3.22
SetIssuedAtClaim sets IssuedAt claim.
func (*User) SetNotBeforeClaim ¶ added in v1.3.22
SetNotBeforeClaim sets NotBefore claim.
func (*User) SetRequestHeaders ¶
SetRequestHeaders sets request headers associated with the user.
func (*User) SetRequestIdentity ¶
SetRequestIdentity sets request identity associated with the user.
func (*User) SetRolesClaim ¶ added in v1.3.22
SetRolesClaim sets Roles claim