Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var JWTAuthFunc = func(ctx context.Context) (context.Context, error) { token, err := authTokenFromMD(ctx, "bearer") if err != nil { return nil, err } parsedToken, err := parseToken(token) if err != nil { return nil, status.Errorf(codes.Unauthenticated, "invalid auth token: %v", err) } newCtx := context.WithValue(ctx, authTokenCTX{}, parsedToken) return newCtx, nil }
Methode um den Token zu prüfen und bei Erfolg in den context zu legen. Das Abfragen der userdb und erstellen des Tokens passiert in package internal/auth
Functions ¶
func CheckPasswordHash ¶
Passwort hash prüfen true => passwort io, false => stimmt nicht
func GetSubjectFromContext ¶
get the subject (user id) from auth context
func GetUsernameFromContext ¶ added in v0.5.0
get the username from auth context
Types ¶
Click to show internal directories.
Click to hide internal directories.