Documentation
¶
Index ¶
- type Info
- type InfoProvider
- type InfoUIResponse
- type Link
- type Login
- func (m *Login) AuthCodeRedirectURL(r *http.Request, providerName string) (string, error)
- func (m *Login) AuthCodeReturn(w http.ResponseWriter, r *http.Request, customClaim *claims.Custom)
- func (m *Login) AuthCodeURL(r *http.Request, state, providerName string, oauth2 *session.Oauth2) (string, error)
- func (m *Login) CheckState(w http.ResponseWriter, r *http.Request, check string) error
- func (m *Login) CodeFlow(w http.ResponseWriter, r *http.Request)
- func (m *Login) CodeFlowInit(w http.ResponseWriter, r *http.Request, providerName string)
- func (m *Login) CodeToken(r *http.Request, code, providerName string, oauth2 *session.Oauth2) ([]byte, int, error)
- func (m *Login) GetState(r *http.Request) (string, error)
- func (m *Login) GetSuccess(r http.Request) (string, error)
- func (m *Login) InformationUI(w http.ResponseWriter, r *http.Request)
- func (m *Login) Init() error
- func (m *Login) IsForRedirection(r *http.Request) bool
- func (m *Login) IsValidRedirectURI(redirectURI string) bool
- func (m *Login) IssuerPasswordToken(ctx context.Context, issuerName, username, password string, ...) ([]byte, int, error)
- func (m *Login) Logout(w http.ResponseWriter, r *http.Request)
- func (m *Login) Middleware(ctx context.Context) (func(http.Handler) http.Handler, error)
- func (m *Login) PasskeyFlow(w http.ResponseWriter, r *http.Request)
- func (m *Login) PasswordFlow(w http.ResponseWriter, r *http.Request)
- func (m *Login) PasswordToken(ctx context.Context, username, password string, oauth2 *session.Oauth2) ([]byte, int, error)
- func (m *Login) RemotePasskeyToken(r *http.Request, passkeyURL string, body []byte) ([]byte, int, error)
- func (m *Login) RemoveState(w http.ResponseWriter)
- func (m *Login) RemoveSuccess(w http.ResponseWriter)
- func (m *Login) SetFiles() error
- func (m *Login) SetState(w http.ResponseWriter, state string)
- func (m *Login) SetSuccess(w http.ResponseWriter, success string)
- func (m *Login) SetUI() (func(http.Handler) http.Handler, error)
- func (m *Login) SignupFlow(w http.ResponseWriter, r *http.Request, action string)
- func (m *Login) StatusHandler(w http.ResponseWriter, r *http.Request)
- func (m *Login) UIHandler(w http.ResponseWriter, r *http.Request)
- type Path
- type PathFixed
- type Redirect
- type Request
- type TokenRequest
- type UI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InfoProvider ¶
type InfoUIResponse ¶
type InfoUIResponse struct {
Title string `json:"title"`
Provider InfoProvider `json:"provider"`
Error string `json:"error,omitempty"`
}
type Link ¶
type Link struct {
Name string `json:"name"`
URL string `json:"url"`
Priority int `json:"-"`
// optional signup / forgot-password proxy endpoints; only set on
// password providers whose auth middleware enables those flows.
SignupURL string `json:"signup_url,omitempty"`
SignupVerifyURL string `json:"signup_verify_url,omitempty"`
PasswordResetURL string `json:"password_reset_url,omitempty"`
PasswordResetConfirmURL string `json:"password_reset_confirm_url,omitempty"`
// PasswordMinLength is advertised so the signup/reset forms can enforce
// and display the configured minimum; 0 means the UI default applies.
PasswordMinLength int `json:"password_min_length,omitempty"`
}
type Login ¶
type Login struct {
Path Path `cfg:"path"`
Redirect Redirect `cfg:"redirect"`
UI UI `cfg:"ui"`
Info Info `cfg:"info"`
Request Request `cfg:"request"`
SessionMiddleware string `cfg:"session_middleware"`
StateCookie auth.Cookie `cfg:"state_cookie"`
SuccessCookie auth.Cookie `cfg:"success_cookie"`
// Store for effect code, only for code flow and works with redis.
Store store.Store `cfg:"store"`
RedirectWhiteList []string `cfg:"redirect_white_list"`
// contains filtered or unexported fields
}
Login middleware gives a login page.
func (*Login) AuthCodeRedirectURL ¶
func (*Login) AuthCodeReturn ¶ added in v0.8.14
func (*Login) AuthCodeURL ¶
func (*Login) CheckState ¶
func (*Login) CodeFlowInit ¶
func (*Login) CodeToken ¶
func (m *Login) CodeToken(r *http.Request, code, providerName string, oauth2 *session.Oauth2) ([]byte, int, error)
CodeToken get token and set the cookie/session.
func (*Login) InformationUI ¶
func (m *Login) InformationUI(w http.ResponseWriter, r *http.Request)
func (*Login) IsForRedirection ¶ added in v0.8.14
func (*Login) IsValidRedirectURI ¶ added in v0.8.14
func (*Login) IssuerPasswordToken ¶ added in v0.9.0
func (m *Login) IssuerPasswordToken(ctx context.Context, issuerName, username, password string, oauth2 *session.Oauth2) ([]byte, int, error)
IssuerPasswordToken runs the password grant in-process against a registered issuer (auth middleware) instead of calling token_url over HTTP.
func (*Login) Middleware ¶
func (*Login) PasskeyFlow ¶ added in v0.9.0
func (m *Login) PasskeyFlow(w http.ResponseWriter, r *http.Request)
PasskeyFlow proxies WebAuthn begin/finish ceremonies to an in-process auth middleware; a finish response with tokens is stored in the session.
func (*Login) PasswordFlow ¶
func (m *Login) PasswordFlow(w http.ResponseWriter, r *http.Request)
func (*Login) PasswordToken ¶
func (*Login) RemotePasskeyToken ¶ added in v0.9.0
func (m *Login) RemotePasskeyToken(r *http.Request, passkeyURL string, body []byte) ([]byte, int, error)
RemotePasskeyToken proxies a WebAuthn begin/finish payload to a remote auth middleware's passkey endpoint. The original request's host/scheme is forwarded so the remote side derives the relying party from the login page. Non-2xx responses are passed through to the caller, not turned into errors.
func (*Login) RemoveState ¶
func (m *Login) RemoveState(w http.ResponseWriter)
func (*Login) RemoveSuccess ¶
func (m *Login) RemoveSuccess(w http.ResponseWriter)
func (*Login) SetSuccess ¶
func (m *Login) SetSuccess(w http.ResponseWriter, success string)
func (*Login) SignupFlow ¶ added in v0.9.0
SignupFlow proxies signup/verify/password-reset requests to the provider's auth middleware, injecting the provider client credentials so the SPA never sees them. Responses are passed through unchanged.
func (*Login) StatusHandler ¶ added in v0.8.14
func (m *Login) StatusHandler(w http.ResponseWriter, r *http.Request)
type Redirect ¶
type Redirect struct {
// BaseURL is the base URL to use for the redirect.
// Default is the request Host with checking the X-Forwarded-Host header.
BaseURL string `cfg:"base_url"`
// Schema is the default schema to use for the redirect if no schema is provided.
// Default is the https schema.
Schema string `cfg:"schema"`
}