Documentation
¶
Index ¶
- Variables
- type Client
- func (c Client) ClientDisconnect(ctx context.Context, logger *slog.Logger, client connection.Client)
- func (c Client) OAuth2Callback() http.Handler
- func (c Client) OAuth2Start() http.Handler
- func (c Client) OAuthConfig() *oauth2.Config
- func (c Client) RefreshClientAuth(ctx context.Context, logger *slog.Logger, client connection.Client) (bool, error)
- type Provider
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMismatch = errors.New("mismatch") ErrMissingClaim = errors.New("missing claim") ErrMissingRequiredRole = errors.New("missing required role") ErrMissingRequiredGroup = errors.New("missing required group") ErrMissingToken = errors.New("no tokens provided") ErrAuthAndTokenEndpointRequired = errors.New("both oauth2.endpoints.tokenUrl and oauth2.endpoints.authUrl are required") ErrNoRefreshToken = errors.New("no refresh token received from provider") ErrClientRejected = errors.New("client rejected") )
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.22.6
type Client struct {
// contains filtered or unexported fields
}
func New ¶ added in v1.13.0
func New(ctx context.Context, logger *slog.Logger, conf config.Config, httpClient *http.Client, tokenStorage tokenstorage.Storage, provider Provider, openvpn openvpnManagementClient, ) (*Client, error)
New returns a Client instance.
func (Client) ClientDisconnect ¶ added in v1.22.6
func (c Client) ClientDisconnect(ctx context.Context, logger *slog.Logger, client connection.Client)
ClientDisconnect purges the refresh token from the tokenstorage.Storage.
func (Client) OAuth2Callback ¶ added in v1.22.6
OAuth2Callback returns a http.Handler that handles the OAuth2 callback.
func (Client) OAuth2Start ¶ added in v1.22.6
OAuth2Start returns a http.Handler that starts the OAuth2 authorization flow. It checks if the request has a valid state GET parameter generated by state.New. Optionally, it checks the HTTP client IP address against the VPN IP address. After the checks, the request is delegated to rp.AuthURLHandler.
func (Client) OAuthConfig ¶ added in v1.22.6
OAuthConfig returns the underlying oauth2.Config used by the relying party. It is primarily exposed for tests that need direct access to the client configuration.
type Provider ¶ added in v1.3.0
type Provider interface { CheckUser(ctx context.Context, session state.State, user types.UserData, tokens *oidc.Tokens[*idtoken.Claims]) error GetProviderConfig() (types.ProviderConfig, error) GetName() string GetRefreshToken(tokens *oidc.Tokens[*idtoken.Claims]) (string, error) GetUser(ctx context.Context, logger *slog.Logger, tokens *oidc.Tokens[*idtoken.Claims]) (types.UserData, error) // Refresh initiates a non-interactive authentication against the sso provider. Refresh(ctx context.Context, logger *slog.Logger, relyingParty rp.RelyingParty, refreshToken string) (*oidc.Tokens[*idtoken.Claims], error) RevokeRefreshToken(ctx context.Context, logger *slog.Logger, relyingParty rp.RelyingParty, refreshToken string) error }
Click to show internal directories.
Click to hide internal directories.