auth

package
v0.20.7 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTokenAuthConfig = &TokenAuthConfig{
	SourceBearerEnabled:    true,
	sourceBasicAuthEnabled: true,
	ValidTokenType:         m.UserTokenTypeSession,
}

DefaultTokenAuthConfig default configuration

Functions

func VerifyAccessTokenAndCreateUser

func VerifyAccessTokenAndCreateUser(accessToken string) (*m.User, error)

VerifyAccessTokenAndCreateUser verifies the given access_token, if the token is valid, create and return the user object, otherwise return error message instead.

Types

type TokenAuthConfig

type TokenAuthConfig struct {
	SourceBearerEnabled bool

	// Only token in this type will be considered as valid
	ValidTokenType uint
	// contains filtered or unexported fields
}

TokenAuthConfig configuration for bcs-api auth

type TokenAuthenticater

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

TokenAuthenticater token auth implementation

func NewTokenAuthenticater

func NewTokenAuthenticater(req *http.Request, config *TokenAuthConfig) *TokenAuthenticater

NewTokenAuthenticater create auth implementation from request

func (*TokenAuthenticater) GetUser

func (ta *TokenAuthenticater) GetUser() (*m.User, bool)

GetUser get user information from specified token

func (*TokenAuthenticater) GetUserFromToken

func (ta *TokenAuthenticater) GetUserFromToken(s string) (*m.User, bool)

GetUserFromToken returns a user object if the given token is valid

func (*TokenAuthenticater) GetUserTokenType

func (ta *TokenAuthenticater) GetUserTokenType() uint

GetUserTokenType check user token type

func (*TokenAuthenticater) ParseTokenBasicAuth

func (ta *TokenAuthenticater) ParseTokenBasicAuth() string

ParseTokenBasicAuth parse token basic auth information

func (*TokenAuthenticater) ParseTokenBearer

func (ta *TokenAuthenticater) ParseTokenBearer() string

ParseTokenBearer parse toke bearer information

func (*TokenAuthenticater) ParseTokenString

func (ta *TokenAuthenticater) ParseTokenString() string

ParseTokenString parses token string from incoming request, currently supports authorization header and basicauth

Jump to

Keyboard shortcuts

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