Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotValidToken = fmt.Errorf("token is not valid") ErrFailedGetClaim = fmt.Errorf("failed to get token claims") )
Functions ¶
func NewServer ¶
func NewServer( srv fasthttp.RequestHandler, errorProcessor ErrorProcessor, errorCreator ErrorCreator, jwtHeaderName string, authHeaderScheme []byte, verifier Verifier, contextTokenStorage ContextTokenStorage, ) fasthttp.RequestHandler
NewServer ...
Types ¶
type ContextTokenStorage ¶
type ContextTokenStorage interface { Set(ctx *fasthttp.RequestCtx, token JWT) Get(ctx context.Context) (token JWT, found bool) }
ContextTokenStorage represents interface for token set and get methods to request context
func NewContextTokenStorage ¶
func NewContextTokenStorage(ctxJWTKey string) ContextTokenStorage
NewContextTokenStorage creates new ContextTokenStorage
type ErrorCreator ¶
type ErrorProcessor ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator ...
type JWT ¶
type JWT struct { Original []byte `json:"original"` // contains original jwt Links [][]byte `json:"links"` }
JWT represents a parsed and verified access token.
type PrivateKeyLoader ¶
type PrivateKeyLoader struct {
// contains filtered or unexported fields
}
PrivateKeyLoader ...
func NewPrivateKeyLoader ¶
func NewPrivateKeyLoader(jwkUse string, jwkAlgorithm string, hash crypto.Hash) *PrivateKeyLoader
NewPrivateKeyLoader ...
jwkUse = "sig" jwkAlgorithm = "RS256" hash = crypto.SHA256
func (*PrivateKeyLoader) Load ¶
func (p *PrivateKeyLoader) Load(file string) (privateKey jose.JSONWebKey, err error)
Load ...
type PublicKeyLoader ¶
type PublicKeyLoader struct {
// contains filtered or unexported fields
}
PublicKeyLoader ...
func NewPublicKeyLoader ¶
func NewPublicKeyLoader(jwkUse string, jwkAlgorithm string, hash crypto.Hash) *PublicKeyLoader
NewPublicKeyLoader ... example:
jwkUse = "sig" jwkAlgorithm = "RS256" hash = crypto.SHA256
func (*PublicKeyLoader) Load ¶
func (p *PublicKeyLoader) Load(file string) (publicKey jose.JSONWebKey, err error)
Load ...
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(ctx *fasthttp.RequestCtx)
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
func NewVerifier ¶
NewVerifier creates a new Generator verifier.
Click to show internal directories.
Click to hide internal directories.