user

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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

func (u Anonymous) Authorized() bool

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

func (u Anonymous) ClaimValue(name ...string) string

ClaimValue returns claim value. If multiple names are provided, claim that matches first name will be returned.

func (Anonymous) DisplayName

func (u Anonymous) DisplayName() string

DisplayName returns users display name.

func (Anonymous) FamilyName

func (u Anonymous) FamilyName() string

FamilyName returns users family name.

func (Anonymous) GivenName

func (u Anonymous) GivenName() string

GivenName returns users given name.

func (Anonymous) HasScope

func (u Anonymous) HasScope(name string) bool

HasScope checks if user has granted scope with any level.

func (Anonymous) HasScopeAnyLevel added in v0.13.1

func (u Anonymous) HasScopeAnyLevel(name string, levels ...string) bool

HasScopeLevel checks if user has granted scope with at least one of levels.

func (Anonymous) HasScopeGroup

func (u Anonymous) HasScopeGroup(name string) bool

HasScopeGroup checks if user has any granted scopes in specified group.

func (Anonymous) HasScopeLevel

func (u Anonymous) HasScopeLevel(name string, level string) bool

HasScopeLevel checks if user has granted scope with exact level.

func (Anonymous) ID added in v0.6.1

func (u Anonymous) ID() string

ID returns user ID.

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

func (u *Basic) Authorized() bool

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

func (u *Basic) ClaimValue(name ...string) string

ClaimValue returns claim value. If multiple names are provided, claim that matches first name will be returned.

func (*Basic) DisplayName

func (u *Basic) DisplayName() string

DisplayName returns users display name.

func (*Basic) FamilyName

func (u *Basic) FamilyName() string

FamilyName returns users family name.

func (*Basic) GivenName

func (u *Basic) GivenName() string

GivenName returns users given name.

func (*Basic) HasScope

func (u *Basic) HasScope(name string) bool

HasScope checks if user has granted scope with any level.

func (*Basic) HasScopeAnyLevel added in v0.13.1

func (u *Basic) HasScopeAnyLevel(name string, levels ...string) bool

HasScopeAnyLevel checks if user has granted scope with one of levels.

func (*Basic) HasScopeGroup

func (u *Basic) HasScopeGroup(name string) bool

HasScopeGroup checks if user has any granted scopes in specified group.

func (*Basic) HasScopeLevel

func (u *Basic) HasScopeLevel(name string, level string) bool

HasScopeLevel checks if user has granted scope with exact level.

func (*Basic) ID added in v0.6.1

func (u *Basic) ID() string

ID returns user ID.

func (Basic) MarshalJSON

func (u Basic) MarshalJSON() (b []byte, err error)

func (*Basic) UnmarshalJSON

func (u *Basic) UnmarshalJSON(data []byte) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL