Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilContext = errors.New("context cannot be nil") ErrNilOptions = errors.New("options cannot be nil") )
Functions ¶
This section is empty.
Types ¶
type AuthenticationParser ¶
type AuthenticationParser interface {
ParseAuthorizationMetadataAsHeader(
w http.ResponseWriter,
ctx context.Context,
) error
ParseAuthorizationMetadataAsCookie(
w http.ResponseWriter,
ctx context.Context,
) error
}
AuthenticationParser parses the metadata authentication from a gRPC to the header or as a cookie
type DefaultAuthenticationParser ¶
type DefaultAuthenticationParser struct {
// contains filtered or unexported fields
}
DefaultAuthenticationParser is the default implementation of AuthenticationParser
func NewDefaultAuthenticationParser ¶
func NewDefaultAuthenticationParser( options *Options, ) ( *DefaultAuthenticationParser, error, )
NewDefaultAuthenticationParser parses the metadata authentication from a gRPC to the header or as a cookie
Parameters:
- options: the options for the DefaultAuthenticationParser
Returns:
- ParseAuthorizationMetadataAsHeader: parses the authorization metadata as a header - error: error if something goes wrong
func (DefaultAuthenticationParser) ParseAuthorizationMetadataAsCookie ¶
func (d DefaultAuthenticationParser) ParseAuthorizationMetadataAsCookie( w http.ResponseWriter, ctx context.Context, ) error
ParseAuthorizationMetadataAsCookie parses the authorization metadata as a cookie
Parameters:
- w: http.ResponseWriter - ctx: context.Context
Returns:
- error: error if something goes wrong
func (DefaultAuthenticationParser) ParseAuthorizationMetadataAsHeader ¶
func (d DefaultAuthenticationParser) ParseAuthorizationMetadataAsHeader( w http.ResponseWriter, ctx context.Context, ) error
ParseAuthorizationMetadataAsHeader parses the authorization metadata as a header
Parameters:
- w: http.ResponseWriter - ctx: context.Context
Returns:
- error: error if something goes wrong
type GetExpiresAtFn ¶
GetExpiresAtFn is a function that returns the expiration time for a token
type Options ¶
type Options struct {
MetadataKeysToAuthorizationHeaderNames map[string]string
MetadataKeysToCookiesAttributes map[string]*gonethttpcookie.Attributes
AuthorizationCookieAttributes *gonethttpcookie.Attributes
GetExpiresAtFn GetExpiresAtFn
}
Options is the options for the DefaultAuthenticationParser