Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoOidcToken ¶ added in v1.0.5
GoOidcToken returns the jwt token found in the context returns a nil pointer if nothing exists
func Oauth2TokenSource ¶ added in v1.0.5
func Oauth2TokenSource(c *fiber.Ctx) oauth2.TokenSource
func ProviderAuth ¶ added in v1.1.0
func ProviderAuth(c *fiber.Ctx) *provider.ProviderAuth
Types ¶
type Config ¶
type Config struct {
provider.OidcProviderConfig
WebAppConfig
}
func (*Config) WithDefaults ¶
Helper function to set default values
type FiberOidc ¶
type FiberOidc interface {
// Allows protection of a single route
// Will redirect if required
ProtectedRoute() fiber.Handler
// Does not protect the route, but will still bind any valid
// auth token to the request
UnprotectedRoute() fiber.Handler
// Handles the OIDC callback
CallbackHandler() fiber.Handler
// easy access to the callback path
CallbackPath() string
Providers() provider.Providers
}
type FiberOidcStruct ¶
type FiberOidcStruct struct {
Config *Config
OidcProviders *provider.OidcProviders
}
direct access to fields, if you need to tweak or override something which should, of course, be entirely unnessesary
func (*FiberOidcStruct) CallbackHandler ¶
func (obj *FiberOidcStruct) CallbackHandler() fiber.Handler
func (*FiberOidcStruct) CallbackPath ¶
func (obj *FiberOidcStruct) CallbackPath() string
func (*FiberOidcStruct) ProtectedRoute ¶
func (obj *FiberOidcStruct) ProtectedRoute() fiber.Handler
func (*FiberOidcStruct) Providers ¶ added in v1.0.5
func (obj *FiberOidcStruct) Providers() provider.Providers
func (*FiberOidcStruct) UnprotectedRoute ¶
func (obj *FiberOidcStruct) UnprotectedRoute() fiber.Handler
type WebAppConfig ¶ added in v1.1.0
type WebAppConfig struct {
// OPTIONAL, defaults to true
AutoRefreshOnExpiry *bool
// OPTIONAL
// trigger oidc callback on this path.
// It MUST match the RedirectUri value
// If blank, this is default to the entire path from the RedirectUri
CallbackPath string
// OPTIONAL
// if set, also use an auth cookie (allow identity token to be set directly)
AuthCookieName string
// OPTIONAL
// if set, also use an auth cookie (allow identity token to be set directly)
AuthRefreshCookieName string
// Unauthorized defines the response body for unauthorized responses.
// By default it will return with a 401 Unauthorized and the correct WWW-Auth header
Unauthorized fiber.Handler
// OPTIONAL
// Called to serialize state for the OIDC redirect
// If unspecified, will just the be the current path
//
// Should be paired with a SuccessHandler if provided
LoginStateEncoder func(c *fiber.Ctx) (string, error)
// OPTIONAL
//
// Called on login success to restore any application state there
// may have been.
// if unspecified, will assume that 'state' was the url path, and redirect there
//
// Should be paired with a StateEncoder if provided
LoginSuccessHandler func(state string, c *fiber.Ctx) error
}
Config defines the config for middleware.
Click to show internal directories.
Click to hide internal directories.