Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractHeaderToken(token string) string
- func FromJWTContext(ctx context.Context) (jwt string, ok bool)
- func NewClaimsContext(ctx context.Context, claims *Claims) context.Context
- func NewJWTContext(ctx context.Context, jwt string) context.Context
- func ServerAuth(logger log.Logger) middleware.Middleware
- func ServerExtract(tokenizer Tokenizer, logger log.Logger) middleware.Middleware
- func ServerExtractAndAuth(tokenizer Tokenizer, logger log.Logger) middleware.Middleware
- type Claims
- type Tokenizer
- type TokenizerConfig
Constants ¶
View Source
const ( AuthorizationHeader = "Authorization" BearerTokenType = "Bearer" AuthorizationQuery = "access_token" )
Variables ¶
View Source
var ProviderSet = wire.NewSet(NewTokenizer, NewTokenizerConfig)
Functions ¶
func ExtractHeaderToken ¶
func ServerAuth ¶
func ServerAuth(logger log.Logger) middleware.Middleware
func ServerExtract ¶
func ServerExtract(tokenizer Tokenizer, logger log.Logger) middleware.Middleware
func ServerExtractAndAuth ¶
func ServerExtractAndAuth(tokenizer Tokenizer, logger log.Logger) middleware.Middleware
Types ¶
type Claims ¶
type Claims struct { Uid string `json:"id,omitempty"` ClientId string `json:"clientId,omitempty"` jwt.StandardClaims }
func NewClientClaim ¶
func NewUserClaim ¶
type Tokenizer ¶
type Tokenizer interface { Issue(claims *Claims, duration time.Duration) (token string, err error) Parse(token string) (claims *Claims, err error) }
func NewTokenizer ¶
func NewTokenizer(c *TokenizerConfig) Tokenizer
type TokenizerConfig ¶
func NewTokenizerConfig ¶
func NewTokenizerConfig(c *conf.Security) *TokenizerConfig
Click to show internal directories.
Click to hide internal directories.