Documentation
¶
Index ¶
- Constants
- func Cors(opts ...cors.Option) func(http.Handler) http.Handler
- func ExtractAccountUUID(opts ...account.Option) func(http.Handler) http.Handler
- func Logger(logger log.Logger) func(http.Handler) http.Handler
- func NoCache(next http.Handler) http.Handler
- func OidcAuth(opts ...Option) func(http.Handler) http.Handler
- func Static(root string, fs http.FileSystem, ttl int) func(http.Handler) http.Handler
- func Throttle(limit int) func(http.Handler) http.Handler
- func TraceContext(next http.Handler) http.Handler
- func Version(name, version string) func(http.Handler) http.Handler
- type OIDCProvider
- type Option
- type Options
Constants ¶
const AccountID string = "Account-Id"
AccountID serves as key for the account uuid in the context
const RoleIDs string = "Role-Ids"
RoleIDs serves as key for the roles in the context
Variables ¶
This section is empty.
Functions ¶
func ExtractAccountUUID ¶
ExtractAccountUUID provides a middleware to extract the account uuid from the x-access-token header value and write it to the context. If there is no x-access-token the middleware is omitted.
func Logger ¶
Logger is a middleware to log http requests. It uses debug level logging and should be used by all services save the proxy (which uses info level logging).
func OidcAuth ¶
OidcAuth provides a middleware to authenticate a bearer auth with an OpenID Connect identity provider It will put all claims provided by the userinfo endpoint in the context
func TraceContext ¶
TraceContext unpacks the request context looking for an existing trace id.
Types ¶
type OIDCProvider ¶
type OIDCProvider interface {
UserInfo(ctx context.Context, ts oauth2.TokenSource) (*goidc.UserInfo, error)
}
OIDCProvider used to mock the oidc provider during tests
type Option ¶
type Option func(o *Options)
Option defines a single option function.
func WithGatewayAPIClient ¶
func WithGatewayAPIClient(val gatewayv1beta1.GatewayAPIClient) Option
WithGatewayAPIClient provides a function to set the reva gateway client option.
func WithHttpClient ¶
HttpClient provides a function to set the http client option.
func WithLogger ¶
WithLogger provides a function to set the logger option.
func WithOidcIssuer ¶
WithLogger provides a function to set the openid connect issuer option.
type Options ¶
type Options struct {
// Logger to use for logging, must be set
Logger log.Logger
// The OpenID Connect Issuer URL
OidcIssuer string
// GatewayAPIClient is a reva gateway client
GatewayAPIClient gatewayv1beta1.GatewayAPIClient
// HttpClient is a http client
HttpClient http.Client
}
Options defines the available options for this package.