Documentation
¶
Overview ¶
Package oidcclient implements a basic oidc client to authenticate users at an OpenID Connect IdP using the Code flow.
Index ¶
Constants ¶
View Source
const ( // DefaultLoginTimeout is the age, in seconds, of the state cookie during OIDC login. DefaultLoginTimeout = 600 // 10m // DefaultCookiePath sets the URL path cookies from this package are valid for. DefaultCookiePath = "/api/auth" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OidcClient ¶
type OidcClient struct {
Name string
//OnLogin func(w http.ResponseWriter, r *http.Request, sub string, exp time.Time) error
//OnLogin func(http.ResponseWriter, *http.Request, *oauth2.Token, *gooidc.IDToken) error
OnLogin func(http.ResponseWriter, *http.Request, *oauth2.Token, *gooidc.IDToken) error
// contains filtered or unexported fields
}
OidcClient holds the OpenID Connect and OAuth2 configuration for an authentication provider.
func NewOidcClient ¶
func NewOidcClient(name string, id string, secret string, redirectUrl string, providerUrl string, frontendUrl string) (*OidcClient, error)
NewOidcClient creates a new OpenID Connect client for the given provider and credentials.
func (*OidcClient) Auth ¶
func (client *OidcClient) Auth() http.HandlerFunc
Auth is a HTTP handler that forwards the OIDC client to the Authorization endpoint.
func (*OidcClient) Callback ¶
func (client *OidcClient) Callback() http.HandlerFunc
Callback is a HTTP handler that takes the callback from the OIDC token endpoint.
func (*OidcClient) DumpToken ¶
func (client *OidcClient) DumpToken(w http.ResponseWriter, token *oauth2.Token, idToken *gooidc.IDToken)
func (*OidcClient) SetLogger ¶
func (client *OidcClient) SetLogger(logger zerolog.Logger)
SetLogger sets the logger for the OIDC client. It is probably not safe to call this after the handlers are instantiated.
Click to show internal directories.
Click to hide internal directories.