Documentation
¶
Overview ¶
Package auth implements OIDC multi-provider authentication and session management
Index ¶
- type Auth
- func (a *Auth) DestroySession(r *fastglue.Request) error
- func (a *Auth) ExchangeOIDCToken(ctx context.Context, providerID int, code string) (string, OIDCclaim, error)
- func (a *Auth) GetSessionValue(r *fastglue.Request, key string) (any, error)
- func (a *Auth) LoginURL(providerID int, state string) (string, error)
- func (a *Auth) Reload(cfg Config) error
- func (a *Auth) SaveSession(user amodels.User, r *fastglue.Request) error
- func (a *Auth) SetCSRFCookie(r *fastglue.Request) error
- func (a *Auth) SetSessionValues(r *fastglue.Request, values map[string]interface{}) error
- func (a *Auth) TestProvider(url string) error
- func (a *Auth) ValidateSession(r *fastglue.Request) (models.User, error)
- type Config
- type OIDCclaim
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is the auth service it manages OIDC authentication and sessions
func (*Auth) DestroySession ¶
DestroySession destroys session
func (*Auth) ExchangeOIDCToken ¶
func (a *Auth) ExchangeOIDCToken(ctx context.Context, providerID int, code string) (string, OIDCclaim, error)
ExchangeOIDCToken takes an OIDC authorization code, validates it, and returns an OIDC token for subsequent auth.
func (*Auth) GetSessionValue ¶
GetSessionValue returns the value for the given key from the session.
func (*Auth) SaveSession ¶
SaveSession creates and sets a session (post successful login/auth).
func (*Auth) SetCSRFCookie ¶
SetCSRFCookie sets the CSRF token in the response cookie if not already set.
func (*Auth) SetSessionValues ¶
SetSessionValues sets passed values in the session.
func (*Auth) TestProvider ¶
TestProvider tests the OIDC provider url by doing a discovery on it.