oauth

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorProviderNotFound = errors.New("the identity provider was not found")
)

Functions

This section is empty.

Types

type DynamicOptions

type DynamicOptions map[string]interface{}

func (DynamicOptions) MarshalJSON

func (o DynamicOptions) MarshalJSON() ([]byte, error)

type IdentityProviderOptions

type IdentityProviderOptions struct {
	// The provider name.
	Name string `json:"name" yaml:"name"`

	// Defines how new identities are mapped to users when they login. Allowed values are:
	//  - auto:   The default value.The user will automatically create and mapping when login successful.
	//            Fails if a user with that user name is already mapped to another identity.
	//  - lookup: Looks up an existing identity, user identity mapping, and user, but does not automatically
	//            provision users or identities. Using this method requires you to manually provision users.
	//  - mixed:  A user entity can be mapped with multiple identifyProvider.
	MappingMethod MappingMethod `json:"mappingMethod" yaml:"mappingMethod"`

	// The type of identify provider
	// OpenIDIdentityProvider LDAPIdentityProvider GitHubIdentityProvider
	Type string `json:"type" yaml:"type"`

	// The options of identify provider
	Provider DynamicOptions `json:"provider" yaml:"provider"`
}

type IdentityProviderType

type IdentityProviderType string

type MappingMethod

type MappingMethod string
const (
	// MappingMethodAuto  The default value.The user will automatically create and mapping when login successful.
	// Fails if a user with that username is already mapped to another identity.
	MappingMethodAuto MappingMethod = "auto"
	// MappingMethodLookup Looks up an existing identity, user identity mapping, and user, but does not automatically
	// provision users or identities. Using this method requires you to manually provision users.
	// not supported yet.
	MappingMethodLookup MappingMethod = "lookup"
	// MappingMethodMixed  A user entity can be mapped with multiple identifyProvider.
	// not supported yet.
	MappingMethodMixed MappingMethod = "mixed"
)

type Options

type Options struct {
	IdentityProviders            []IdentityProviderOptions `json:"identityProviders,omitempty" yaml:"identityProviders,omitempty"`
	AccessTokenMaxAge            time.Duration             `json:"accessTokenMaxAge" yaml:"accessTokenMaxAge"`
	AccessTokenInactivityTimeout time.Duration             `json:"accessTokenInactivityTimeout" yaml:"accessTokenInactivityTimeout"`
}

func NewOauthOptions

func NewOauthOptions() *Options

func (*Options) IdentityProviderOptions

func (o *Options) IdentityProviderOptions(name string) (*IdentityProviderOptions, error)

type Token

type Token struct {
	// AccessToken is the token that authorizes and authenticates
	// the requests.
	AccessToken string `json:"access_token"`

	// TokenType is the type of token.
	// The Type method returns either this or "Bearer", the default.
	TokenType string `json:"token_type,omitempty"`

	// RefreshToken is a token that's used by the application
	// (as opposed to the user) to refresh the access token
	// if it expires.
	RefreshToken string `json:"refresh_token,omitempty"`

	// ExpiresIn is the optional expiration second of the access token.
	ExpiresIn int `json:"expires_in,omitempty"`

	// RefreshExpiresIn is the optional expiration second of the refresh token.
	RefreshExpiresIn int `json:"refresh_expires_in,omitempty"`
}

Jump to

Keyboard shortcuts

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