oauth

package
v3.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TopLevelClaimUserInfo = "userinfo"
	TopLevelClaimIDToken  = "id_token"
)

JSON keys for top-level member of the Claims request JSON.

Variables

View Source
var (
	// OAuthTypeChecker checks the Identity for OAuth Identity
	OAuthTypeChecker = func(identity auth.Identity) bool {
		_, ok := identity.(Identity)

		return ok
	}
)
View Source
var (

	// OpenIDTypeChecker checks the Identity for OpenID Identity
	OpenIDTypeChecker = func(identity auth.Identity) bool {
		_, ok := identity.(OpenIDIdentity)

		return ok
	}
)

Functions

This section is empty.

Types

type AuthCodeOptioner

type AuthCodeOptioner interface {
	Options(ctx context.Context, broker string, request *web.Request) []oauth2.AuthCodeOption
}

AuthCodeOptioner returns an oauth2.AuthCodeOption for the broker

type CallbackErrorHandler added in v3.5.0

type CallbackErrorHandler interface {
	Handle(ctx context.Context, broker string, request *web.Request, originalReturnTo func(request *web.Request) *url.URL, errString string, errDetails string) web.Result
}

CallbackErrorHandler can be used to handle errors in the Callback e.g. to cover prompt=none cases

type ClaimSet

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

ClaimSet contains map with members of the Claims request. It provides methods to add specific Claims.

func (*ClaimSet) AddClaimWithValue

func (c *ClaimSet) AddClaimWithValue(topLevelName string, claimName string, essential bool, value string)

AddClaimWithValue adds the Claim being requested to return a particular value. The Claim can be defined as an Essential Claim.

func (*ClaimSet) AddClaimWithValues

func (c *ClaimSet) AddClaimWithValues(topLevelName string, claimName string, essential bool, values ...string)

AddClaimWithValues adds the Claim being requested to return one of a set of values, with the values appearing in order of preference. The Claim can be defined as an Essential Claim.

func (*ClaimSet) AddVoluntaryClaim

func (c *ClaimSet) AddVoluntaryClaim(topLevelName string, claimName string)

AddVoluntaryClaim adds the Claim being requested in default manner, as a Voluntary Claim.

func (*ClaimSet) AuthCodeOption

func (c *ClaimSet) AuthCodeOption() (oauth2.AuthCodeOption, error)

AuthCodeOption returns oauth2.AuthCodeOption with json encoded body containing all defined claims. It returns error in case when json marshalling can not be performed.

func (*ClaimSet) HasClaims

func (c *ClaimSet) HasClaims() bool

HasClaims returns true if there are any configured claims

type Identity

type Identity interface {
	auth.Identity
	TokenSource() oauth2.TokenSource
	AccessTokenClaims(into interface{}) error
}

Identity defines a TokenSource which is can be used to get an AccessToken vor OAuth2 flows

type Module

type Module struct{}

Module provides OpenID Connect support

func (*Module) Configure

func (*Module) Configure(injector *dingo.Injector)

Configure dependency injection

func (*Module) CueConfig

func (*Module) CueConfig() string

CueConfig schema

func (*Module) Depends

func (*Module) Depends() []dingo.Module

Depends marks dependency to auth.WebModule

type OpenIDIdentity

type OpenIDIdentity interface {
	auth.Identity
	Identity
	IDToken() *oidc.IDToken
	IDTokenClaims(into interface{}) error
}

OpenIDIdentity is an extension of Identity which provides an IDToken on top of OAuth2

type StateEntry added in v3.4.0

type StateEntry struct {
	State string
	TS    time.Time
}

StateEntry stores entries of recent states during login (oidc states)

Jump to

Keyboard shortcuts

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