auth

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func GetAuthToken

func GetAuthToken(req *http.Request) string

Types

type Token

type Token struct {
	Token         string              `json:"-"`
	Sub           string              `json:"sub,omitempty"`
	RealmAccess   map[string][]string `json:"realm_access,omitempty"`
	Expiration    int64               `json:"exp"`
	Email         string              `json:"email"`
	EmailVerified bool                `json:"email_verified"`
}

func GetParsedToken

func GetParsedToken(req *http.Request) (token Token, err error)

func ParseAndValidateToken

func ParseAndValidateToken(token string, pubRsaKey string) (claims Token, err error)

func (*Token) GetUserId

func (this *Token) GetUserId() string

func (*Token) IsAdmin

func (this *Token) IsAdmin() bool

func (*Token) IsExpired

func (this *Token) IsExpired() 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