Documentation ¶
Index ¶
- func CanonicalHref(href string) string
- func CreateAuthMiddleware(authInterceptor Interceptor, onUnauthorizedAccessFunc OnUnauthorizedAccessFunc) func(next netHttp.Handler) netHttp.Handler
- func CreateLoggingMiddleware(opts ...LogOpt) func(next http.Handler) http.Handler
- func DefaultCodeToLevel(code int, logger log.Logger) func(args ...interface{})
- func ErrToStatus(err error) int
- func ErrToStatusWithDef(err error, def int) int
- func ParseToken(auth string) (string, error)
- func ToURLString(scheme string, host string, path string) string
- func WantToLog(code int, logger log.Logger) bool
- type AuthArgs
- type Claims
- type ClaimsFunc
- type DeniedClaims
- type Interceptor
- type LogOpt
- type OnUnauthorizedAccessFunc
- type RequestMatcher
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAuthMiddleware ¶
func CreateAuthMiddleware(authInterceptor Interceptor, onUnauthorizedAccessFunc OnUnauthorizedAccessFunc) func(next netHttp.Handler) netHttp.Handler
CreateAuthMiddleware creates middleware for authorization
func CreateLoggingMiddleware ¶ added in v2.2.4
func DefaultCodeToLevel ¶ added in v2.2.4
DefaultCodeToLevel is the default implementation of gRPC return codes and interceptor log level for server side.
func ErrToStatusWithDef ¶
ErrToStatusWithDef converts err with default http.Status(for unknown conversion) to http.Status.
func ParseToken ¶
func ToURLString ¶
ToURLString convert scheme, host, path to escaped url.
Types ¶
type ClaimsFunc ¶
func MakeClaimsFunc ¶
func MakeClaimsFunc(methods map[string][]AuthArgs) ClaimsFunc
type DeniedClaims ¶
type DeniedClaims struct {
Err error
}
func (DeniedClaims) Valid ¶
func (c DeniedClaims) Valid() error
type Interceptor ¶
func NewInterceptor ¶
func NewInterceptor(jwksURL string, tls *tls.Config, auths map[string][]AuthArgs, whiteList ...RequestMatcher) Interceptor
NewInterceptor authorizes HTTP request.
func NewInterceptorWithValidator ¶
func NewInterceptorWithValidator(validator Validator, auths map[string][]AuthArgs, whiteList ...RequestMatcher) Interceptor
NewInterceptor authorizes HTTP request with validator.
type RequestMatcher ¶
RequestMatcher allows request without token validation.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.