auth

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthToken

func GetAuthToken(req *http.Request) string

Types

type KeycloakClaims

type KeycloakClaims struct {
	RealmAccess RealmAccess `json:"realm_access"`
	jwt.StandardClaims
}

type RealmAccess

type RealmAccess struct {
	Roles []string `json:"roles"`
}

type Token

type Token struct {
	Token       string      `json:"-"`
	Sub         string      `json:"sub,omitempty"`
	RealmAccess RealmAccess `json:"realm_access,omitempty"`
}

func CreateToken

func CreateToken(issuer string, userId string) (token Token, err error)

func CreateTokenWithRoles

func CreateTokenWithRoles(issuer string, userId string, roles []string) (token Token, err error)

func GetParsedToken

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

func Parse

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

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