Documentation
¶
Index ¶
- Variables
- func AccessTokenFromContext(ctx context.Context) string
- func ContextWithAccessToken(ctx context.Context, token string) context.Context
- func ContextWithOIDCUserInfo(ctx context.Context, userInfo *goth.User) context.Context
- func OIDCUserInfoFromContext(ctx context.Context) *goth.User
- type CookieConfig
- type Handler
- type OIDCConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultCookieDomain = "localhost" DefaultCookiePath = "/" DefaultTokenCookieName = "oidc_token" DefaultTokenCookieMaxAge = time.Hour DefaultStateCookieName = "oidc_state" DefaultStateCookieMaxAge = 5 * time.Minute DefaultRefreshCookieName = "oidc_refresh" DefaultRefreshCookieMaxAge = 24 * time.Hour DefaultTokenExpiryCookieName = "oidc_expires_in" )
Functions ¶
func AccessTokenFromContext ¶
func ContextWithAccessToken ¶
func ContextWithOIDCUserInfo ¶
ContextWithOIDCUserInfo returns a new context with the provided OIDC user info.
Types ¶
type CookieConfig ¶
func (CookieConfig) Delete ¶
func (c CookieConfig) Delete(w http.ResponseWriter)
func (CookieConfig) Set ¶
func (c CookieConfig) Set(w http.ResponseWriter, value string)
type Handler ¶
type Handler struct {
Client *oidc.Client
Config OIDCConfig
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) AuthStart ¶
func (h *Handler) AuthStart() http.HandlerFunc
AuthStart initiates the OIDC authentication flow.
func (*Handler) Callback ¶
func (h *Handler) Callback() http.HandlerFunc
Callback handles the OIDC provider callback and sets cookies.
func (*Handler) Logout ¶
func (h *Handler) Logout() http.HandlerFunc
Logout clears all authentication cookies and redirects to root.
type OIDCConfig ¶
type OIDCConfig struct {
Scopes []string
RedirectURI string
TokenCookieConfig CookieConfig
StateCookieConfig CookieConfig
RefreshCookieConfig CookieConfig
TokenExpiryCookieConfig CookieConfig
RedirectCookieConfig CookieConfig
RefreshWindow time.Duration
Now func() time.Time `json:"-,omitzero"`
LoginPath string
}
Click to show internal directories.
Click to hide internal directories.