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(
ctx context.Context,
w http.ResponseWriter,
) error
ParseAuthorizationMetadataAsCookie(
ctx context.Context,
w http.ResponseWriter,
) 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( ctx context.Context, w http.ResponseWriter, ) error
ParseAuthorizationMetadataAsCookie parses the authorization metadata as a cookie
Parameters:
- ctx: context.Context - w: http.ResponseWriter
Returns:
- error: error if something goes wrong
func (DefaultAuthenticationParser) ParseAuthorizationMetadataAsHeader ¶
func (d DefaultAuthenticationParser) ParseAuthorizationMetadataAsHeader( ctx context.Context, w http.ResponseWriter, ) error
ParseAuthorizationMetadataAsHeader parses the authorization metadata as a header
Parameters:
- ctx: context.Context - w: http.ResponseWriter
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
GetExpiresAtFn GetExpiresAtFn
}
Options is the options for the DefaultAuthenticationParser