Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ScopeOpenID will return basic information ScopeOpenID = "openid" // ScopeOfflineAccess will return refresh token ScopeOfflineAccess = "offline_access" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Next http.Handler
Next http.Handler
// CallbackPath to handle authorization callback
CallbackPath string
// AuthClient for handling authentication flow
AuthClient *oauth2.Config
// AdditionalAuthURLParameters for providers who require additional authorization parameters,
// like Auth0 requires to set and "audience" parameter in order to receive a JWT access token
AdditionalAuthURLParameters []oauth2.AuthCodeOption
// SessionStore for persisting session state
SessionStore sessions.Store
// SkipAuthenticationRegex for skipping authentication on these paths
SkipAuthenticationRegex []string
// SkipRedirectToLoginRegex for skipping redirecting user to auth provider's login page.
// If a path matches one of these, a response with status code 401 with
// JSON with redirectUrl field will be returned. Use this to prevent the middleware redirecting
// API requests to the login page.
SkipRedirectToLoginRegex []string
// Logger, optional
Logger *log.Logger
// contains filtered or unexported fields
}
Config for Middleware
type Middleware ¶
type Middleware struct {
*Config
}
Middleware for authentication requests
func NewMiddleware ¶
func NewMiddleware(config *Config) (*Middleware, error)
NewMiddleware creates a new authentication middleware
func (*Middleware) ServeHTTP ¶
func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP will authenticate the request and forward it to the next http.Handler
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
authproxy
command
|
|
|
echoserver
command
|
|
|
internal
|
|
|
random
Package random provides functions for generating random length strings and byte slices.
|
Package random provides functions for generating random length strings and byte slices. |
|
server
Package server implements a HTTP server
|
Package server implements a HTTP server |
|
Package oidc provides functions for interacting with OpenID Connect providers
|
Package oidc provides functions for interacting with OpenID Connect providers |
|
Package upstream offers different upstream implementations used as http.Handler
|
Package upstream offers different upstream implementations used as http.Handler |
Click to show internal directories.
Click to hide internal directories.