auth

package
v0.0.0-...-1ee731d Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeNow = func() time.Time {
	return time.Now()
}

Functions

This section is empty.

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func New

func New(config configuration.Config) *Auth

func (*Auth) Ensure

func (this *Auth) Ensure() (token Token, err error)

func (*Auth) ExchangeUserToken

func (this *Auth) ExchangeUserToken(userid string) (token Token, err error)

type OpenidToken

type OpenidToken struct {
	AccessToken      string    `json:"access_token"`
	ExpiresIn        float64   `json:"expires_in"`
	RefreshExpiresIn float64   `json:"refresh_expires_in"`
	RefreshToken     string    `json:"refresh_token"`
	TokenType        string    `json:"token_type"`
	RequestTime      time.Time `json:"-"`
	ParsedToken      Token     `json:"-"`
}

type Token

type Token struct {
	Token       string              `json:"__token"`
	Sub         string              `json:"sub,omitempty"`
	RealmAccess map[string][]string `json:"realm_access,omitempty"`
}

func Parse

func Parse(token string) (claims Token, err error)

func (*Token) GetRoles

func (this *Token) GetRoles() []string

func (*Token) GetUserId

func (this *Token) GetUserId() string

func (*Token) IsAdmin

func (this *Token) IsAdmin() bool

func (*Token) Jwt

func (this *Token) Jwt() string

func (*Token) String

func (this *Token) String() string

func (*Token) Valid

func (this *Token) Valid() error

Jump to

Keyboard shortcuts

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