api

package
v3.11.0-0.4.0+incompat... Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IdentityDisplayNameKey is the key for an optional display name in an identity's Extra map
	IdentityDisplayNameKey = "name"
	// IdentityEmailKey is the key for an optional email address in an identity's Extra map
	IdentityEmailKey = "email"
	// IdentityPreferredUsernameKey is the key for an optional preferred username in an identity's Extra map.
	// This is useful when the immutable providerUserName is different than the login used to authenticate
	// If present, this extra value is used as the preferred username
	IdentityPreferredUsernameKey = "preferred_username"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetId() string
	GetSecret() string
	GetRedirectUri() string
	GetUserData() interface{}
}

type DefaultUserIdentityInfo

type DefaultUserIdentityInfo struct {
	ProviderName     string
	ProviderUserName string
	Extra            map[string]string
}

func NewDefaultUserIdentityInfo

func NewDefaultUserIdentityInfo(providerName, providerUserName string) *DefaultUserIdentityInfo

NewDefaultUserIdentityInfo returns a DefaultUserIdentityInfo with a non-nil Extra component

func (*DefaultUserIdentityInfo) GetExtra

func (i *DefaultUserIdentityInfo) GetExtra() map[string]string

func (*DefaultUserIdentityInfo) GetIdentityName

func (i *DefaultUserIdentityInfo) GetIdentityName() string

func (*DefaultUserIdentityInfo) GetProviderName

func (i *DefaultUserIdentityInfo) GetProviderName() string

func (*DefaultUserIdentityInfo) GetProviderUserName

func (i *DefaultUserIdentityInfo) GetProviderUserName() string

type Grant

type Grant struct {
	Client      Client
	Scope       string
	Expiration  int64
	RedirectURI string
}

type ProviderInfo

type ProviderInfo struct {
	// Name is unique and corresponds to the name of the identity provider in the oauth configuration
	Name string
	// URL to login using this identity provider
	URL string
}

ProviderInfo represents display information for an oauth identity provider. This is used by the selection provider template to render links to login using different identity providers.

type UserIdentityInfo

type UserIdentityInfo interface {
	// GetIdentityName returns the name of this identity. It must be equal to GetProviderName() + ":" + GetProviderUserName()
	GetIdentityName() string
	// GetProviderName returns the name of the provider of this identity.
	GetProviderName() string
	// GetProviderUserName uniquely identifies this particular identity for this provider.  It is NOT guaranteed to be unique across providers
	GetProviderUserName() string
	// GetExtra is a map to allow providers to add additional fields that they understand
	GetExtra() map[string]string
}

UserIdentityInfo contains information about an identity. Identities are distinct from users. An authentication server of some kind (like oauth for example) describes an identity. Our system controls the users mapped to this identity.

type UserIdentityMapper

type UserIdentityMapper interface {
	// UserFor takes an identity, ignores the passed identity.Provider, forces the provider value to some other value and then creates the mapping.
	// It returns the corresponding user.Info
	UserFor(identityInfo UserIdentityInfo) (user.Info, error)
}

UserIdentityMapper maps UserIdentities into user.Info objects to allow different user abstractions within auth code.

Jump to

Keyboard shortcuts

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