compose

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compose

func Compose(config *oauth2.Config, storage any, strategy any, factories ...Factory) oauth2.Provider

Compose takes a config, a storage, a strategy and handlers to instantiate an Provider:

 import "authelia.com/provider/oauth2/compose"

 // var storage = new(MyFositeStorage)
 var config = Config {
 	AccessTokenLifespan: time.Minute * 30,
		// check Config for further configuration options
 }

 var strategy = NewOAuth2HMACStrategy(config)

 var oauth2Provider = Compose(
 	config,
		storage,
		strategy,
		NewOAuth2AuthorizeExplicitHandler,
		OAuth2ClientCredentialsGrantFactory,
		// for a complete list refer to the docs of this package
 )

Compose makes use of any types in order to be able to handle a all types of stores, strategies and handlers.

func ComposeAllEnabled

func ComposeAllEnabled(config *oauth2.Config, storage any, key any) oauth2.Provider

ComposeAllEnabled returns a oauth2 instance with all OAuth2 and OpenID Connect handlers enabled.

func NewOAuth2JWTStrategy

func NewOAuth2JWTStrategy(keyGetter func(context.Context) (any, error), strategy *hoauth2.HMACCoreStrategy, config oauth2.Configurator) *hoauth2.JWTProfileCoreStrategy

func NewOpenIDConnectStrategy

func NewOpenIDConnectStrategy(keyGetter func(context.Context) (any, error), config oauth2.Configurator) *openid.DefaultStrategy

func OAuth2AuthorizeExplicitFactory

func OAuth2AuthorizeExplicitFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2AuthorizeExplicitFactory creates an OAuth2 authorize code grant ("authorize explicit flow") handler and registers an access token, refresh token and authorize code validator.

func OAuth2AuthorizeImplicitFactory

func OAuth2AuthorizeImplicitFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2AuthorizeImplicitFactory creates an OAuth2 implicit grant ("authorize implicit flow") handler and registers an access token, refresh token and authorize code validator.

func OAuth2AuthorizeNoneFactory

func OAuth2AuthorizeNoneFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2AuthorizeNoneFactory creates an OAuth2 handler which handles the "none" response type.

func OAuth2ClientCredentialsGrantFactory

func OAuth2ClientCredentialsGrantFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2ClientCredentialsGrantFactory creates an OAuth2 client credentials grant handler and registers an access token, refresh token and authorize code validator.

func OAuth2PKCEFactory

func OAuth2PKCEFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2PKCEFactory creates a PKCE handler.

func OAuth2RefreshTokenGrantFactory

func OAuth2RefreshTokenGrantFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2RefreshTokenGrantFactory creates an OAuth2 refresh grant handler and registers an access token, refresh token and authorize code validator.nmj

func OAuth2ResourceOwnerPasswordCredentialsFactory deprecated

func OAuth2ResourceOwnerPasswordCredentialsFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2ResourceOwnerPasswordCredentialsFactory creates an OAuth2 resource owner password credentials grant handler and registers an access token, refresh token and authorize code validator.

Deprecated: This factory is deprecated as a means to communicate that the ROPC grant type is widely discouraged and is at the time of this writing going to be omitted in the OAuth 2.1 spec. For more information on why this grant type is discouraged see: https://www.scottbrady91.com/oauth/why-the-resource-owner-password-credentials-grant-type-is-not-authentication-nor-suitable-for-modern-applications

func OAuth2StatelessJWTIntrospectionFactory

func OAuth2StatelessJWTIntrospectionFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2StatelessJWTIntrospectionFactory creates an OAuth2 token introspection handler and registers an access token validator. This can only be used to validate JWTs and does so statelessly, meaning it uses only the data available in the JWT itself, and does not access the storage implementation at all.

Due to the stateless nature of this factory, THE BUILT-IN REVOCATION MECHANISMS WILL NOT WORK. If you need revocation, you can validate JWTs statefully, using the other factories.

func OAuth2TokenIntrospectionFactory

func OAuth2TokenIntrospectionFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2TokenIntrospectionFactory creates an OAuth2 token introspection handler and registers an access token and refresh token validator.

func OAuth2TokenRevocationFactory

func OAuth2TokenRevocationFactory(config oauth2.Configurator, storage any, strategy any) any

OAuth2TokenRevocationFactory creates an OAuth2 token revocation handler.

func OIDCUserinfoVerifiableCredentialFactory

func OIDCUserinfoVerifiableCredentialFactory(config oauth2.Configurator, storage, strategy any) any

OIDCUserinfoVerifiableCredentialFactory creates a verifiable credentials' handler.

func OpenIDConnectDeviceAuthorizeFactory

func OpenIDConnectDeviceAuthorizeFactory(config oauth2.Configurator, storage any, strategy any) any

func OpenIDConnectExplicitFactory

func OpenIDConnectExplicitFactory(config oauth2.Configurator, storage any, strategy any) any

OpenIDConnectExplicitFactory creates an OpenID Connect explicit ("authorize code flow") grant handler.

**Important note:** You must add this handler *after* you have added an OAuth2 authorize code handler!

func OpenIDConnectHybridFactory

func OpenIDConnectHybridFactory(config oauth2.Configurator, storage any, strategy any) any

OpenIDConnectHybridFactory creates an OpenID Connect hybrid grant handler.

**Important note:** You must add this handler *after* you have added an OAuth2 authorize code handler!

func OpenIDConnectImplicitFactory

func OpenIDConnectImplicitFactory(config oauth2.Configurator, storage any, strategy any) any

OpenIDConnectImplicitFactory creates an OpenID Connect implicit ("implicit flow") grant handler.

**Important note:** You must add this handler *after* you have added an OAuth2 authorize code handler!

func OpenIDConnectRefreshFactory

func OpenIDConnectRefreshFactory(config oauth2.Configurator, _ any, strategy any) any

OpenIDConnectRefreshFactory creates a handler for refreshing openid connect tokens.

**Important note:** You must add this handler *after* you have added an OAuth2 authorize code handler!

func PushedAuthorizeHandlerFactory

func PushedAuthorizeHandlerFactory(config oauth2.Configurator, storage any, strategy any) any

PushedAuthorizeHandlerFactory creates the basic PAR handler

func RFC7523AssertionGrantFactory

func RFC7523AssertionGrantFactory(config oauth2.Configurator, storage any, strategy any) any

RFC7523AssertionGrantFactory creates an OAuth2 Authorize JWT Grant (using JWTs as Authorization Grants) handler and registers an access token, refresh token and authorize code validator.

func RFC8628DeviceAuthorizeFactory

func RFC8628DeviceAuthorizeFactory(config oauth2.Configurator, storage any, strategy any) any

RFC8628DeviceAuthorizeFactory creates an OAuth2 device grant authorization handler.

func RFC8628DeviceAuthorizeTokenFactory

func RFC8628DeviceAuthorizeTokenFactory(config oauth2.Configurator, storage any, strategy any) any

RFC8628DeviceAuthorizeTokenFactory creates an OAuth2 device authorization grant ("device authorization flow") handler and registers an access token, refresh token and authorize code validator.

func RFC8628UserAuthorizeFactory

func RFC8628UserAuthorizeFactory(config oauth2.Configurator, storage any, strategy any) any

RFC8628UserAuthorizeFactory creates an OAuth2 device grant user interaction handler.

Types

type Factory

type Factory func(config oauth2.Configurator, storage any, strategy any) any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL