Documentation ¶
Index ¶
- Constants
- Variables
- func CreateAuthToken(ctx context.Context, sessionUpdater APISessionUpdater, JWTSecret string, ...) (string, error)
- func GetBearerToken(req *http.Request) (string, bool)
- func IncreaseSessionLifetime(ctx context.Context, sessionUpdater APISessionUpdater, s session.APISession) error
- func ValidateBearerToken(ctx context.Context, tokCtx *TokenContext, uri, method string, ...) (valid bool, sessionInfo session.APISession, err error)
- type APISessionGetter
- type APISessionUpdater
- type AppTokenClaims
- type Scope
- type TokenContext
Constants ¶
View Source
const ( DefaultMaxTokenLifetime = 90 * 24 * time.Hour DefaultTokenLifetime = 10 * time.Minute )
Variables ¶
View Source
var Scopes2FaCheckOnly = []Scope{ { URI: routes.AllRoutesPrefix + routes.Verify2FaRoute, Method: http.MethodPost, }, }
View Source
var ScopesAllExcluding2FaCheck = []Scope{ { URI: "*", Method: "*", }, { URI: routes.AllRoutesPrefix + routes.Verify2FaRoute, Method: "*", Exclude: true, }, }
View Source
var ScopesTotPCreateOnly = []Scope{ { URI: routes.AllRoutesPrefix + routes.TotPRoutes, Method: http.MethodPost, }, }
Functions ¶
func CreateAuthToken ¶
func IncreaseSessionLifetime ¶
func IncreaseSessionLifetime( ctx context.Context, sessionUpdater APISessionUpdater, s session.APISession) error
func ValidateBearerToken ¶
func ValidateBearerToken( ctx context.Context, tokCtx *TokenContext, uri, method string, apiSessionGetter APISessionGetter, l *logger.Logger) (valid bool, sessionInfo session.APISession, err error)
Types ¶
type APISessionGetter ¶
type APISessionUpdater ¶
type AppTokenClaims ¶
type TokenContext ¶
type TokenContext struct { AppClaims *AppTokenClaims RawToken string JwtToken *jwt.Token }
func ParseToken ¶
func ParseToken(tokenStr string, JWTSecret string) (tokCtx *TokenContext, err error)
Click to show internal directories.
Click to hide internal directories.