Documentation ¶
Index ¶
- Variables
- func AuthMiddleware(verifier TokenVerifier) func(next http.Handler) http.Handler
- func GetTokenInfoFromContext(ctx context.Context) (*client.TokenInfo, bool)
- func GokitAuthMiddleware(verifier TokenVerifier) endpoint.Middleware
- func SetTokenInfoToContext(ctx context.Context, info *client.TokenInfo) context.Context
- type ContextKey
- type IntrospectVerifier
- type JwtVerifier
- type TokenVerifier
Constants ¶
This section is empty.
Variables ¶
View Source
var TokenInfoKey = ContextKey{}
TokenInfoKey is a key for token info in context.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(verifier TokenVerifier) func(next http.Handler) http.Handler
AuthMiddleware is a middleware that checks if the request is authorized.
func GetTokenInfoFromContext ¶
GetTokenInfoFromContext gets token info from context.
func GokitAuthMiddleware ¶
func GokitAuthMiddleware(verifier TokenVerifier) endpoint.Middleware
GokitAuthMiddleware is a middleware for gokit
Types ¶
type IntrospectVerifier ¶
type IntrospectVerifier struct {
// contains filtered or unexported fields
}
IntrospectVerifier is a token verifier that verifies tokens using the introspection endpoint.
func NewIntrospectVerifier ¶
func NewIntrospectVerifier(c oauthClient) *IntrospectVerifier
NewIntrospectVerifier creates a new IntrospectVerifier.
func (*IntrospectVerifier) VerifyToken ¶
func (i *IntrospectVerifier) VerifyToken(tokenString string, tokenType client.TokenType) (*client.TokenInfo, error)
VerifyToken verifies a token. Implements the Verifier interface.
type JwtVerifier ¶
type JwtVerifier struct {
// contains filtered or unexported fields
}
JwtVerifier is a token verifier that verifies JWT tokens.
func NewJwtVerifier ¶
func NewJwtVerifier(signingKey string) *JwtVerifier
NewJwtVerifier creates a new JwtVerifier.
func (*JwtVerifier) VerifyToken ¶
func (j *JwtVerifier) VerifyToken(tokenString string, tokenType client.TokenType) (*client.TokenInfo, error)
VerifyToken verifies a token.
Click to show internal directories.
Click to hide internal directories.