Documentation ¶
Index ¶
- type Anonymous
- func (u Anonymous) Authorized() bool
- func (u Anonymous) Claim(name ...string) token.ClaimStrings
- func (u Anonymous) ClaimValue(name ...string) string
- func (u Anonymous) DisplayName() string
- func (u Anonymous) FamilyName() string
- func (u Anonymous) GivenName() string
- func (u Anonymous) HasScope(name string) bool
- func (u Anonymous) HasScopeAnyLevel(name string, levels ...string) bool
- func (u Anonymous) HasScopeGroup(name string) bool
- func (u Anonymous) HasScopeLevel(name string, level string) bool
- func (u Anonymous) ID() string
- type Basic
- func (u *Basic) Authorized() bool
- func (u *Basic) Claim(name ...string) token.ClaimStrings
- func (u *Basic) ClaimValue(name ...string) string
- func (u *Basic) DisplayName() string
- func (u *Basic) FamilyName() string
- func (u *Basic) GivenName() string
- func (u *Basic) HasScope(name string) bool
- func (u *Basic) HasScopeAnyLevel(name string, levels ...string) bool
- func (u *Basic) HasScopeGroup(name string) bool
- func (u *Basic) HasScopeLevel(name string, level string) bool
- func (u *Basic) ID() string
- func (u Basic) MarshalJSON() (b []byte, err error)
- func (u *Basic) UnmarshalJSON(data []byte) error
- type Option
- type ScopeClaimName
- type ScopeGroupSeparator
- type ScopeLevelSeparator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anonymous ¶
type Anonymous struct{}
Anonymous is a user that is not authorized.
func (Anonymous) Authorized ¶
Authorized returns if user is authorized.
func (Anonymous) Claim ¶
func (u Anonymous) Claim(name ...string) token.ClaimStrings
Claim returns all claims with specified name. If multiple names are provided, claim that matches first name will be returned.
func (Anonymous) ClaimValue ¶
ClaimValue returns claim value. If multiple names are provided, claim that matches first name will be returned.
func (Anonymous) DisplayName ¶
DisplayName returns users display name.
func (Anonymous) FamilyName ¶
FamilyName returns users family name.
func (Anonymous) HasScopeAnyLevel ¶ added in v0.13.1
HasScopeLevel checks if user has granted scope with at least one of levels.
func (Anonymous) HasScopeGroup ¶
HasScopeGroup checks if user has any granted scopes in specified group.
func (Anonymous) HasScopeLevel ¶
HasScopeLevel checks if user has granted scope with exact level.
type Basic ¶
type Basic struct {
// contains filtered or unexported fields
}
Basic represents authorized user.
func New ¶
func New(claims map[string]token.ClaimStrings, options ...Option) *Basic
New returns new user instance with specified claims.
func (*Basic) Authorized ¶
Authorized returns if user is authorized.
func (*Basic) Claim ¶
func (u *Basic) Claim(name ...string) token.ClaimStrings
Claim returns all claims with specified name. If multiple names are provided, claim that matches first name will be returned.
func (*Basic) ClaimValue ¶
ClaimValue returns claim value. If multiple names are provided, claim that matches first name will be returned.
func (*Basic) DisplayName ¶
DisplayName returns users display name.
func (*Basic) FamilyName ¶
FamilyName returns users family name.
func (*Basic) HasScopeAnyLevel ¶ added in v0.13.1
HasScopeAnyLevel checks if user has granted scope with one of levels.
func (*Basic) HasScopeGroup ¶
HasScopeGroup checks if user has any granted scopes in specified group.
func (*Basic) HasScopeLevel ¶
HasScopeLevel checks if user has granted scope with exact level.
func (Basic) MarshalJSON ¶
func (*Basic) UnmarshalJSON ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option represents basic user behavior option.
type ScopeClaimName ¶
type ScopeClaimName string
ScopeClaimName is name of claim that contains user granted scopes.
type ScopeGroupSeparator ¶
type ScopeGroupSeparator string
ScopeGroupSeparator is group separator to use when parsing granted scopes.
type ScopeLevelSeparator ¶
type ScopeLevelSeparator string
ScopeLevelSeparator is level separator to use when parsing granted scopes.