oauth2

package
v1.3.5-0...-de983a4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Name     string `json:"name,omitempty"`
	Method   string `json:"method,omitempty"`
	Realm    string `json:"realm,omitempty"`
	Provider string `json:"provider,omitempty"`

	DomainName   string `json:"domain_name,omitempty"`
	ClientID     string `json:"client_id,omitempty"`
	ClientSecret string `json:"client_secret,omitempty"`
	ServerID     string `json:"server_id,omitempty"`
	AppSecret    string `json:"app_secret,omitempty"`
	TenantID     string `json:"tenant_id,omitempty"`

	Scopes []string `json:"scopes,omitempty"`

	UserRoleMapList []map[string]interface{} `json:"user_roles,omitempty"`

	// The URL to OAuth 2.0 Custom Authorization Server.
	BaseAuthURL string `json:"base_auth_url,omitempty"`
	// The URL to OAuth 2.0 metadata related to your Custom Authorization Server.
	MetadataURL string `json:"metadata_url,omitempty"`

	TokenProvider *jwtconfig.CommonTokenConfig `json:"-"`
	// contains filtered or unexported fields
}

Backend represents authentication provider with OAuth 2.0 backend.

func NewDatabaseBackend

func NewDatabaseBackend() *Backend

NewDatabaseBackend return an instance of authentication provider with OAuth 2.0 backend.

func (*Backend) Authenticate

func (b *Backend) Authenticate(opts map[string]interface{}) (map[string]interface{}, error)

Authenticate performs authentication.

func (*Backend) ConfigureAuthenticator

func (b *Backend) ConfigureAuthenticator() error

ConfigureAuthenticator configures backend authenticator.

func (*Backend) ConfigureLogger

func (b *Backend) ConfigureLogger(logger *zap.Logger) error

ConfigureLogger configures backend with the same logger as its user.

func (*Backend) ConfigureTokenProvider

func (b *Backend) ConfigureTokenProvider(upstream *jwtconfig.CommonTokenConfig) error

ConfigureTokenProvider configures TokenProvider.

func (*Backend) Do

func (b *Backend) Do(opts map[string]interface{}) error

Do performs the requested operation.

func (*Backend) GetMethod

func (b *Backend) GetMethod() string

GetMethod returns the authentication method associated with this backend.

func (*Backend) GetMfaTokens

func (b *Backend) GetMfaTokens(opts map[string]interface{}) ([]*identity.MfaToken, error)

GetMfaTokens return a list of MFA tokens associated with a user.

func (*Backend) GetName

func (b *Backend) GetName() string

GetName return the name associated with this backend.

func (*Backend) GetPublicKeys

func (b *Backend) GetPublicKeys(opts map[string]interface{}) ([]*identity.PublicKey, error)

GetPublicKeys return a list of public keys associated with a user.

func (*Backend) GetRealm

func (b *Backend) GetRealm() string

GetRealm return authentication realm.

func (*Backend) Validate

func (b *Backend) Validate() error

Validate checks whether Backend is functional.

func (*Backend) ValidateConfig

func (b *Backend) ValidateConfig() error

ValidateConfig checks whether Backend has mandatory configuration.

type JwksKey

type JwksKey struct {
	Algorithm    string `json:"alg,omitempty"`
	Exponent     string `json:"e,omitempty"`
	KeyID        string `json:"kid,omitempty"`
	KeyType      string `json:"kty,omitempty"`
	Modulus      string `json:"n,omitempty"`
	PublicKeyUse string `json:"use,omitempty"`
	// contains filtered or unexported fields
}

JwksKey is a JSON object that represents a cryptographic key. See https://tools.ietf.org/html/rfc7517#section-4, https://tools.ietf.org/html/rfc7518#section-6.3

func (*JwksKey) GetPublicKey

func (k *JwksKey) GetPublicKey() *rsa.PublicKey

GetPublicKey returns pointer to rsa.PublicKey.

func (*JwksKey) Validate

func (k *JwksKey) Validate() error

Validate returns error if JwksKey does not contain relevant information.

Jump to

Keyboard shortcuts

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