oidc

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 70 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProfileUrl       string = "" /* 146-byte string literal not displayed */
	EmailUrl         string = "https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))"
	IntrospectionURL string = "https://www.linkedin.com/oauth/v2/introspectToken"
)
View Source
const (
	RouteBase = "/self-service/methods/oidc"

	RouteAuth     = RouteBase + "/auth/:flow"
	RouteCallback = RouteBase + "/callback/:provider"
)

Variables

View Source
var (
	ErrScopeMissing = herodot.ErrBadRequest.
					WithError("authentication failed because a required scope was not granted").
					WithReasonf(`Unable to finish because one or more permissions were not granted. Please retry and accept all permissions.`)

	ErrIDTokenMissing = herodot.ErrBadRequest.
						WithError("authentication failed because id_token is missing").
						WithReasonf(`Authentication failed because no id_token was returned. Please accept the "openid" permission and try again.`)
)
View Source
var ConnectionExistValidationError = &jsonschema.ValidationError{
	Message: "can not link unknown or already existing OpenID Connect connection", InstancePtr: "#/"}
View Source
var UnknownConnectionValidationError = &jsonschema.ValidationError{
	Message: "can not unlink non-existing OpenID Connect connection", InstancePtr: "#/"}
View Source
var UnlinkAllFirstFactorConnectionsError = &jsonschema.ValidationError{
	Message: "can not unlink OpenID Connect connection because it is the last remaining first factor credential", InstancePtr: "#/"}

Functions

func AddProvider

func AddProvider(c *container.Container, providerID string, message *text.Message)

func AddProviders

func AddProviders(c *container.Container, providers []Configuration, message func(provider string) *text.Message)

func NewLinkNode

func NewLinkNode(provider string) *node.Node

func NewUnlinkNode

func NewUnlinkNode(provider string) *node.Node

func UpstreamParameters added in v0.13.0

func UpstreamParameters(provider Provider, upstreamParameters map[string]string) []oauth2.AuthCodeOption

UpstreamParameters returns a list of oauth2.AuthCodeOption based on the upstream parameters.

Only allowed parameters are returned and the rest is ignored. Allowed parameters are also defined in the `oidc/.schema/link.schema.json` file, however, this function also validates the parameters to prevent any potential security issues.

Allowed parameters are: - `login_hint` (string): The `login_hint` parameter suppresses the account chooser and either pre-fills the email box on the sign-in form, or selects the proper session. - `hd` (string): The `hd` parameter limits the login/registration process to a Google Organization, e.g. `mycollege.edu`. - `prompt` (string): The `prompt` specifies whether the Authorization Server prompts the End-User for reauthentication and consent, e.g. `select_account`.

Types

type Claims

type Claims struct {
	Issuer              string                 `json:"iss,omitempty"`
	Subject             string                 `json:"sub,omitempty"`
	Name                string                 `json:"name,omitempty"`
	GivenName           string                 `json:"given_name,omitempty"`
	FamilyName          string                 `json:"family_name,omitempty"`
	LastName            string                 `json:"last_name,omitempty"`
	MiddleName          string                 `json:"middle_name,omitempty"`
	Nickname            string                 `json:"nickname,omitempty"`
	PreferredUsername   string                 `json:"preferred_username,omitempty"`
	Profile             string                 `json:"profile,omitempty"`
	Picture             string                 `json:"picture,omitempty"`
	Website             string                 `json:"website,omitempty"`
	Email               string                 `json:"email,omitempty"`
	EmailVerified       x.ConvertibleBoolean   `json:"email_verified,omitempty"`
	Gender              string                 `json:"gender,omitempty"`
	Birthdate           string                 `json:"birthdate,omitempty"`
	Zoneinfo            string                 `json:"zoneinfo,omitempty"`
	Locale              string                 `json:"locale,omitempty"`
	PhoneNumber         string                 `json:"phone_number,omitempty"`
	PhoneNumberVerified bool                   `json:"phone_number_verified,omitempty"`
	UpdatedAt           int64                  `json:"updated_at,omitempty"`
	HD                  string                 `json:"hd,omitempty"`
	Team                string                 `json:"team,omitempty"`
	RawClaims           map[string]interface{} `json:"raw_claims,omitempty"`
}

ConvertibleBoolean is used as Apple casually sends the email_verified field as a string.

func (*Claims) Validate added in v0.11.1

func (c *Claims) Validate() error

Validate checks if the claims are valid.

type Configuration

type Configuration struct {
	// ID is the provider's ID
	ID string `json:"id"`

	// Provider is either "generic" for a generic OAuth 2.0 / OpenID Connect Provider or one of:
	// - generic
	// - google
	// - github
	// - github-app
	// - gitlab
	// - microsoft
	// - discord
	// - slack
	// - facebook
	// - auth0
	// - vk
	// - yandex
	// - apple
	// - spotify
	// - netid
	// - dingtalk
	// - linkedin
	// - patreon
	Provider string `json:"provider"`

	// Label represents an optional label which can be used in the UI generation.
	Label string `json:"label"`

	// ClientID is the application's Client ID.
	ClientID string `json:"client_id"`

	// ClientSecret is the application's secret.
	ClientSecret string `json:"client_secret"`

	// IssuerURL is the OpenID Connect Server URL. You can leave this empty if `provider` is not set to `generic`.
	// If set, neither `auth_url` nor `token_url` are required.
	IssuerURL string `json:"issuer_url"`

	// AuthURL is the authorize url, typically something like: https://example.org/oauth2/auth
	// Should only be used when the OAuth2 / OpenID Connect server is not supporting OpenID Connect Discovery and when
	// `provider` is set to `generic`.
	AuthURL string `json:"auth_url"`

	// TokenURL is the token url, typically something like: https://example.org/oauth2/token
	// Should only be used when the OAuth2 / OpenID Connect server is not supporting OpenID Connect Discovery and when
	// `provider` is set to `generic`.
	TokenURL string `json:"token_url"`

	// Tenant is the Azure AD Tenant to use for authentication, and must be set when `provider` is set to `microsoft`.
	// Can be either `common`, `organizations`, `consumers` for a multitenant application or a specific tenant like
	// `8eaef023-2b34-4da1-9baa-8bc8c9d6a490` or `contoso.onmicrosoft.com`.
	Tenant string `json:"microsoft_tenant"`

	// SubjectSource is a flag which controls from which endpoint the subject identifier is taken by microsoft provider.
	// Can be either `userinfo` or `me`.
	// If the value is `uerinfo` then the subject identifier is taken from sub field of uderifo standard endpoint response.
	// If the value is `me` then the `id` field of https://graph.microsoft.com/v1.0/me response is taken as subject.
	// The default is `userinfo`.
	SubjectSource string `json:"subject_source"`

	// TeamId is the Apple Developer Team ID that's needed for the `apple` `provider` to work.
	// It can be found Apple Developer website and combined with `apple_private_key` and `apple_private_key_id`
	// is used to generate `client_secret`
	TeamId string `json:"apple_team_id"`

	// PrivateKeyId is the private Apple key identifier. Keys can be generated via developer.apple.com.
	// This key should be generated with the `Sign In with Apple` option checked.
	// This is needed when `provider` is set to `apple`
	PrivateKeyId string `json:"apple_private_key_id"`

	// PrivateKeyId is the Apple private key identifier that can be downloaded during key generation.
	// This is needed when `provider` is set to `apple`
	PrivateKey string `json:"apple_private_key"`

	// Scope specifies optional requested permissions.
	Scope []string `json:"scope"`

	// Mapper specifies the JSONNet code snippet which uses the OpenID Connect Provider's data (e.g. GitHub or Google
	// profile information) to hydrate the identity's data.
	//
	// It can be either a URL (file://, http(s)://, base64://) or an inline JSONNet code snippet.
	Mapper string `json:"mapper_url"`

	// RequestedClaims string encoded json object that specifies claims and optionally their properties which should be
	// included in the id_token or returned from the UserInfo Endpoint.
	//
	// More information: https://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter
	RequestedClaims json.RawMessage `json:"requested_claims"`
}

func (Configuration) Redir

func (p Configuration) Redir(public *url.URL) string

type ConfigurationCollection

type ConfigurationCollection struct {
	BaseRedirectURI string          `json:"base_redirect_uri"`
	Providers       []Configuration `json:"providers"`
}

func (ConfigurationCollection) Provider

func (c ConfigurationCollection) Provider(id string, reg dependencies) (Provider, error)

type FlowMethod

type FlowMethod struct {
	*container.Container
}

func NewFlowMethod

func NewFlowMethod(f *container.Container) *FlowMethod

type LinkedInEmail added in v0.13.0

type LinkedInEmail struct {
	Elements []struct {
		Handle struct {
			EmailAddress string `json:"emailAddress"`
		} `json:"handle~"`
		HandleUrn string `json:"handle"`
	} `json:"elements"`
}

type LinkedInIntrospection added in v0.13.0

type LinkedInIntrospection struct {
	Active       bool   `json:"active"`
	ClientID     string `json:"client_id"`
	AuthorizedAt uint32 `json:"authorized_at"`
	CreatedAt    uint32 `json:"created_at"`
	ExpiresAt    uint32 `json:"expires_at"`
	Status       string `json:"status"`
	Scope        string `json:"scope"`
	AuthType     string `json:"auth_type"`
}

type LinkedInProfile added in v0.13.0

type LinkedInProfile struct {
	LocalizedLastName  string `json:"localizedLastName"`
	LocalizedFirstName string `json:"localizedFirstName"`
	ProfilePicture     *struct {
		DisplayImage struct {
			Elements []struct {
				Identifiers []struct {
					Identifier string `json:"identifier"`
				} `json:"identifiers"`
			} `json:"elements"`
		} `json:"displayImage~"`
	} `json:"profilePicture,omitempty"`
	ID string `json:"id"`
}

type MetadataType added in v0.11.0

type MetadataType string
const (
	PublicMetadata MetadataType = "identity.metadata_public"
	AdminMetadata  MetadataType = "identity.metadata_admin"
)

type PatreonIdentityResponse added in v0.13.0

type PatreonIdentityResponse struct {
	Data struct {
		Attributes struct {
			Email     string `json:"email"`
			FirstName string `json:"first_name"`
			FullName  string `json:"full_name"`
			ImageUrl  string `json:"image_url"`
			LastName  string `json:"last_name"`
		} `json:"attributes"`
		Id   string `json:"id"`
		Type string `json:"type"`
	} `json:"data"`
}

type Provider

type Provider interface {
	Config() *Configuration
	OAuth2(ctx context.Context) (*oauth2.Config, error)
	Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)
	AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption
}

type ProviderApple

type ProviderApple struct {
	*ProviderGenericOIDC
}

func NewProviderApple

func NewProviderApple(
	config *Configuration,
	reg dependencies,
) *ProviderApple

func (*ProviderApple) AuthCodeURLOptions

func (a *ProviderApple) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderApple) Claims

func (a *ProviderApple) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderApple) OAuth2

func (a *ProviderApple) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderAuth0

type ProviderAuth0 struct {
	*ProviderGenericOIDC
}

func NewProviderAuth0

func NewProviderAuth0(
	config *Configuration,
	reg dependencies,
) *ProviderAuth0

func (*ProviderAuth0) Claims

func (g *ProviderAuth0) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderAuth0) OAuth2

func (g *ProviderAuth0) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderDingTalk added in v0.11.0

type ProviderDingTalk struct {
	// contains filtered or unexported fields
}

func NewProviderDingTalk added in v0.11.0

func NewProviderDingTalk(
	config *Configuration,
	reg dependencies,
) *ProviderDingTalk

func (*ProviderDingTalk) AuthCodeURLOptions added in v0.11.0

func (g *ProviderDingTalk) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderDingTalk) Claims added in v0.11.0

func (g *ProviderDingTalk) Claims(ctx context.Context, exchange *oauth2.Token, _ url.Values) (*Claims, error)

func (*ProviderDingTalk) Config added in v0.11.0

func (g *ProviderDingTalk) Config() *Configuration

func (*ProviderDingTalk) Exchange added in v0.11.0

func (g *ProviderDingTalk) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

func (*ProviderDingTalk) OAuth2 added in v0.11.0

func (g *ProviderDingTalk) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderDiscord

type ProviderDiscord struct {
	// contains filtered or unexported fields
}

func NewProviderDiscord

func NewProviderDiscord(
	config *Configuration,
	reg dependencies,
) *ProviderDiscord

func (*ProviderDiscord) AuthCodeURLOptions

func (d *ProviderDiscord) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderDiscord) Claims

func (d *ProviderDiscord) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderDiscord) Config

func (d *ProviderDiscord) Config() *Configuration

func (*ProviderDiscord) OAuth2

func (d *ProviderDiscord) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderFacebook

type ProviderFacebook struct {
	*ProviderGenericOIDC
}

func NewProviderFacebook

func NewProviderFacebook(
	config *Configuration,
	reg dependencies,
) *ProviderFacebook

func (*ProviderFacebook) Claims

func (g *ProviderFacebook) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderFacebook) OAuth2

func (g *ProviderFacebook) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderGenericOIDC

type ProviderGenericOIDC struct {
	// contains filtered or unexported fields
}

func NewProviderGenericOIDC

func NewProviderGenericOIDC(
	config *Configuration,
	reg dependencies,
) *ProviderGenericOIDC

func (*ProviderGenericOIDC) AuthCodeURLOptions

func (g *ProviderGenericOIDC) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderGenericOIDC) Claims

func (g *ProviderGenericOIDC) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderGenericOIDC) Config

func (g *ProviderGenericOIDC) Config() *Configuration

func (*ProviderGenericOIDC) OAuth2

type ProviderGitHub

type ProviderGitHub struct {
	// contains filtered or unexported fields
}

func NewProviderGitHub

func NewProviderGitHub(
	config *Configuration,
	reg dependencies,
) *ProviderGitHub

func (*ProviderGitHub) AuthCodeURLOptions

func (g *ProviderGitHub) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderGitHub) Claims

func (g *ProviderGitHub) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderGitHub) Config

func (g *ProviderGitHub) Config() *Configuration

func (*ProviderGitHub) OAuth2

func (g *ProviderGitHub) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderGitHubApp

type ProviderGitHubApp struct {
	// contains filtered or unexported fields
}

func NewProviderGitHubApp

func NewProviderGitHubApp(
	config *Configuration,
	reg dependencies,
) *ProviderGitHubApp

func (*ProviderGitHubApp) AuthCodeURLOptions

func (g *ProviderGitHubApp) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderGitHubApp) Claims

func (g *ProviderGitHubApp) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderGitHubApp) Config

func (g *ProviderGitHubApp) Config() *Configuration

func (*ProviderGitHubApp) OAuth2

func (g *ProviderGitHubApp) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderGitLab

type ProviderGitLab struct {
	*ProviderGenericOIDC
}

func NewProviderGitLab

func NewProviderGitLab(
	config *Configuration,
	reg dependencies,
) *ProviderGitLab

func (*ProviderGitLab) Claims

func (g *ProviderGitLab) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderGitLab) OAuth2

func (g *ProviderGitLab) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderGoogle

type ProviderGoogle struct {
	*ProviderGenericOIDC
}

func NewProviderGoogle

func NewProviderGoogle(
	config *Configuration,
	reg dependencies,
) *ProviderGoogle

func (*ProviderGoogle) AuthCodeURLOptions added in v0.13.0

func (g *ProviderGoogle) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderGoogle) OAuth2 added in v0.13.0

func (g *ProviderGoogle) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderLark added in v1.0.0

type ProviderLark struct {
	*ProviderGenericOIDC
}

func NewProviderLark added in v1.0.0

func NewProviderLark(
	config *Configuration,
	reg dependencies,
) *ProviderLark

func (*ProviderLark) AuthCodeURLOptions added in v1.0.0

func (pl *ProviderLark) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderLark) Claims added in v1.0.0

func (g *ProviderLark) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderLark) Config added in v1.0.0

func (g *ProviderLark) Config() *Configuration

func (*ProviderLark) OAuth2 added in v1.0.0

func (g *ProviderLark) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderLinkedIn added in v0.13.0

type ProviderLinkedIn struct {
	// contains filtered or unexported fields
}

func NewProviderLinkedIn added in v0.13.0

func NewProviderLinkedIn(
	config *Configuration,
	reg dependencies,
) *ProviderLinkedIn

func (*ProviderLinkedIn) AuthCodeURLOptions added in v0.13.0

func (l *ProviderLinkedIn) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderLinkedIn) Claims added in v0.13.0

func (l *ProviderLinkedIn) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (_ *Claims, err error)

func (*ProviderLinkedIn) Config added in v0.13.0

func (l *ProviderLinkedIn) Config() *Configuration

func (*ProviderLinkedIn) Email added in v0.13.0

func (l *ProviderLinkedIn) Email(ctx context.Context, client *retryablehttp.Client) (*LinkedInEmail, error)

func (*ProviderLinkedIn) OAuth2 added in v0.13.0

func (l *ProviderLinkedIn) OAuth2(ctx context.Context) (*oauth2.Config, error)

func (*ProviderLinkedIn) Profile added in v0.13.0

func (l *ProviderLinkedIn) Profile(ctx context.Context, client *retryablehttp.Client) (*LinkedInProfile, error)

func (*ProviderLinkedIn) ProfilePicture added in v0.13.0

func (l *ProviderLinkedIn) ProfilePicture(profile *LinkedInProfile) string

type ProviderMicrosoft

type ProviderMicrosoft struct {
	*ProviderGenericOIDC
}

func NewProviderMicrosoft

func NewProviderMicrosoft(
	config *Configuration,
	reg dependencies,
) *ProviderMicrosoft

func (*ProviderMicrosoft) Claims

func (m *ProviderMicrosoft) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderMicrosoft) OAuth2

func (m *ProviderMicrosoft) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderNetID

type ProviderNetID struct {
	*ProviderGenericOIDC
}

func NewProviderNetID

func NewProviderNetID(
	config *Configuration,
	reg dependencies,
) *ProviderNetID

func (*ProviderNetID) Claims

func (n *ProviderNetID) Claims(ctx context.Context, exchange *oauth2.Token, _ url.Values) (*Claims, error)

func (*ProviderNetID) OAuth2

func (n *ProviderNetID) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderPatreon added in v0.13.0

type ProviderPatreon struct {
	// contains filtered or unexported fields
}

func NewProviderPatreon added in v0.13.0

func NewProviderPatreon(
	config *Configuration,
	reg dependencies,
) *ProviderPatreon

func (*ProviderPatreon) AuthCodeURLOptions added in v0.13.0

func (d *ProviderPatreon) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderPatreon) Claims added in v0.13.0

func (d *ProviderPatreon) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderPatreon) Config added in v0.13.0

func (d *ProviderPatreon) Config() *Configuration

func (*ProviderPatreon) OAuth2 added in v0.13.0

func (d *ProviderPatreon) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderSlack

type ProviderSlack struct {
	// contains filtered or unexported fields
}

func NewProviderSlack

func NewProviderSlack(
	config *Configuration,
	reg dependencies,
) *ProviderSlack

func (*ProviderSlack) AuthCodeURLOptions

func (d *ProviderSlack) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderSlack) Claims

func (d *ProviderSlack) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderSlack) Config

func (d *ProviderSlack) Config() *Configuration

func (*ProviderSlack) OAuth2

func (d *ProviderSlack) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderSpotify

type ProviderSpotify struct {
	// contains filtered or unexported fields
}

func NewProviderSpotify

func NewProviderSpotify(
	config *Configuration,
	reg dependencies,
) *ProviderSpotify

func (*ProviderSpotify) AuthCodeURLOptions

func (g *ProviderSpotify) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderSpotify) Claims

func (g *ProviderSpotify) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderSpotify) Config

func (g *ProviderSpotify) Config() *Configuration

func (*ProviderSpotify) OAuth2

func (g *ProviderSpotify) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderVK

type ProviderVK struct {
	// contains filtered or unexported fields
}

func NewProviderVK

func NewProviderVK(
	config *Configuration,
	reg dependencies,
) *ProviderVK

func (*ProviderVK) AuthCodeURLOptions

func (g *ProviderVK) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderVK) Claims

func (g *ProviderVK) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderVK) Config

func (g *ProviderVK) Config() *Configuration

func (*ProviderVK) OAuth2

func (g *ProviderVK) OAuth2(ctx context.Context) (*oauth2.Config, error)

type ProviderYandex

type ProviderYandex struct {
	// contains filtered or unexported fields
}

func NewProviderYandex

func NewProviderYandex(
	config *Configuration,
	reg dependencies,
) *ProviderYandex

func (*ProviderYandex) AuthCodeURLOptions

func (g *ProviderYandex) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption

func (*ProviderYandex) Claims

func (g *ProviderYandex) Claims(ctx context.Context, exchange *oauth2.Token, query url.Values) (*Claims, error)

func (*ProviderYandex) Config

func (g *ProviderYandex) Config() *Configuration

func (*ProviderYandex) OAuth2

func (g *ProviderYandex) OAuth2(ctx context.Context) (*oauth2.Config, error)

type State added in v1.0.0

type State struct {
	FlowID string
	Data   []byte
}

func (*State) String added in v1.0.0

func (s *State) String() string

type Strategy

type Strategy struct {
	// contains filtered or unexported fields
}

Strategy implements selfservice.LoginStrategy, selfservice.RegistrationStrategy and selfservice.SettingsStrategy. It supports login, registration and settings via OpenID Providers.

func NewStrategy

func NewStrategy(d dependencies) *Strategy

func (*Strategy) CompletedAuthenticationMethod

func (s *Strategy) CompletedAuthenticationMethod(ctx context.Context) session.AuthenticationMethod

func (*Strategy) Config

func (*Strategy) CountActiveFirstFactorCredentials

func (s *Strategy) CountActiveFirstFactorCredentials(cc map[identity.CredentialsType]identity.Credentials) (count int, err error)

func (*Strategy) CountActiveMultiFactorCredentials

func (s *Strategy) CountActiveMultiFactorCredentials(cc map[identity.CredentialsType]identity.Credentials) (count int, err error)

func (*Strategy) ID

func (*Strategy) Login

func (s *Strategy) Login(w http.ResponseWriter, r *http.Request, f *login.Flow, _ uuid.UUID) (i *identity.Identity, err error)

func (*Strategy) NodeGroup

func (s *Strategy) NodeGroup() node.UiNodeGroup

func (*Strategy) PopulateLoginMethod

func (s *Strategy) PopulateLoginMethod(r *http.Request, requestedAAL identity.AuthenticatorAssuranceLevel, l *login.Flow) error

func (*Strategy) PopulateRegistrationMethod

func (s *Strategy) PopulateRegistrationMethod(r *http.Request, f *registration.Flow) error

func (*Strategy) PopulateSettingsMethod

func (s *Strategy) PopulateSettingsMethod(r *http.Request, id *identity.Identity, sr *settings.Flow) error

func (*Strategy) Register

func (s *Strategy) Register(w http.ResponseWriter, r *http.Request, f *registration.Flow, i *identity.Identity) (err error)

func (*Strategy) RegisterLoginRoutes

func (s *Strategy) RegisterLoginRoutes(r *x.RouterPublic)

func (*Strategy) RegisterRegistrationRoutes

func (s *Strategy) RegisterRegistrationRoutes(r *x.RouterPublic)

func (*Strategy) RegisterSettingsRoutes

func (s *Strategy) RegisterSettingsRoutes(router *x.RouterPublic)

func (*Strategy) Settings

func (*Strategy) SettingsStrategyID

func (s *Strategy) SettingsStrategyID() string

type TokenExchanger added in v0.11.0

type TokenExchanger interface {
	Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
}

type UpdateLoginFlowWithOidcMethod added in v0.11.0

type UpdateLoginFlowWithOidcMethod struct {
	// The provider to register with
	//
	// required: true
	Provider string `json:"provider"`

	// The CSRF Token
	CSRFToken string `json:"csrf_token"`

	// Method to use
	//
	// This field must be set to `oidc` when using the oidc method.
	//
	// required: true
	Method string `json:"method"`

	// The identity traits. This is a placeholder for the registration flow.
	Traits json.RawMessage `json:"traits"`

	// UpstreamParameters are the parameters that are passed to the upstream identity provider.
	//
	// These parameters are optional and depend on what the upstream identity provider supports.
	// Supported parameters are:
	// - `login_hint` (string): The `login_hint` parameter suppresses the account chooser and either pre-fills the email box on the sign-in form, or selects the proper session.
	// - `hd` (string): The `hd` parameter limits the login/registration process to a Google Organization, e.g. `mycollege.edu`.
	// - `prompt` (string): The `prompt` specifies whether the Authorization Server prompts the End-User for reauthentication and consent, e.g. `select_account`.
	//
	// required: false
	UpstreamParameters json.RawMessage `json:"upstream_parameters"`
}

Update Login Flow with OpenID Connect Method

swagger:model updateLoginFlowWithOidcMethod

type UpdateRegistrationFlowWithOidcMethod added in v0.11.0

type UpdateRegistrationFlowWithOidcMethod struct {
	// The provider to register with
	//
	// required: true
	Provider string `json:"provider"`

	// The CSRF Token
	CSRFToken string `json:"csrf_token"`

	// The identity traits
	Traits json.RawMessage `json:"traits"`

	// Method to use
	//
	// This field must be set to `oidc` when using the oidc method.
	//
	// required: true
	Method string `json:"method"`

	// Transient data to pass along to any webhooks
	//
	// required: false
	TransientPayload json.RawMessage `json:"transient_payload,omitempty"`

	// UpstreamParameters are the parameters that are passed to the upstream identity provider.
	//
	// These parameters are optional and depend on what the upstream identity provider supports.
	// Supported parameters are:
	// - `login_hint` (string): The `login_hint` parameter suppresses the account chooser and either pre-fills the email box on the sign-in form, or selects the proper session.
	// - `hd` (string): The `hd` parameter limits the login/registration process to a Google Organization, e.g. `mycollege.edu`.
	// - `prompt` (string): The `prompt` specifies whether the Authorization Server prompts the End-User for reauthentication and consent, e.g. `select_account`.
	//
	// required: false
	UpstreamParameters json.RawMessage `json:"upstream_parameters"`
}

Update Registration Flow with OpenID Connect Method

swagger:model updateRegistrationFlowWithOidcMethod

Jump to

Keyboard shortcuts

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