mock

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticateMethod

type AuthenticateMethod func(*Identifier, context.Context, *web.Request) web.Result

AuthenticateMethod callback for Mock Identifier

type CallbackMethod

type CallbackMethod func(*Identifier, context.Context, *web.Request, func(*web.Request) *url.URL) web.Result

CallbackMethod callback for Mock Identifier

type Identifier

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

Identifier mocks request identification

func SingleIdentityIdentifier

func SingleIdentityIdentifier(broker string, identity auth.Identity) *Identifier

SingleIdentityIdentifier returns a mocked broker with a given identity

func (*Identifier) Authenticate

func (m *Identifier) Authenticate(ctx context.Context, request *web.Request) web.Result

Authenticate an incoming request

func (*Identifier) Broker

func (m *Identifier) Broker() string

Broker getter

func (*Identifier) Callback

func (m *Identifier) Callback(ctx context.Context, request *web.Request, returnTo func(*web.Request) *url.URL) web.Result

Callback an incoming request

func (*Identifier) Identify

func (m *Identifier) Identify(ctx context.Context, r *web.Request) (auth.Identity, error)

Identify an incoming request

func (*Identifier) Logout

func (m *Identifier) Logout(ctx context.Context, request *web.Request)

Logout an incoming request

func (*Identifier) SetAuthenticateMethod

func (m *Identifier) SetAuthenticateMethod(method AuthenticateMethod) *Identifier

SetAuthenticateMethod for mock identifier

func (*Identifier) SetBroker

func (m *Identifier) SetBroker(broker string)

SetBroker identity for the identifier

func (*Identifier) SetCallbackMethod

func (m *Identifier) SetCallbackMethod(method CallbackMethod) *Identifier

SetCallbackMethod for mock identifier

func (*Identifier) SetIdentifyMethod

func (m *Identifier) SetIdentifyMethod(method IdentifyMethod) *Identifier

SetIdentifyMethod for mock identifier

func (*Identifier) SetLogoutMethod

func (m *Identifier) SetLogoutMethod(method LogoutMethod) *Identifier

SetLogoutMethod for mock identifier

type IdentifyMethod

type IdentifyMethod func(*Identifier, context.Context, *web.Request) (auth.Identity, error)

IdentifyMethod callback for Mock Identifier

func SingleIdentityIdentifyMethod

func SingleIdentityIdentifyMethod(identity auth.Identity) IdentifyMethod

SingleIdentityIdentifyMethod returns an IdentifyMethod which will always return the specified identity

type Identity

type Identity struct {
	Sub string
	// contains filtered or unexported fields
}

Identity mocks auth.Identity

func (*Identity) Broker

func (i *Identity) Broker() string

Broker getter

func (*Identity) SetBroker

func (i *Identity) SetBroker(broker string)

SetBroker Setter

func (*Identity) Subject

func (i *Identity) Subject() string

Subject getter

type LogoutMethod

type LogoutMethod func(*Identifier, context.Context, *web.Request)

LogoutMethod callback for Mock Identifier

type OIDCIdentity

type OIDCIdentity struct {
	Identity
	// contains filtered or unexported fields
}

OIDCIdentity mocks oauth.OpenIDIdentity

func (*OIDCIdentity) AccessTokenClaims

func (i *OIDCIdentity) AccessTokenClaims(into interface{}) error

AccessTokenClaims unmarshals the given claims

func (*OIDCIdentity) IDToken

func (i *OIDCIdentity) IDToken() *oidc.IDToken

IDToken getter

func (*OIDCIdentity) IDTokenClaims

func (i *OIDCIdentity) IDTokenClaims(into interface{}) error

IDTokenClaims unmarshals the given claims

func (*OIDCIdentity) SetAccessTokenClaims

func (i *OIDCIdentity) SetAccessTokenClaims(claims interface{}) (err error)

SetAccessTokenClaims marshals the given claims

func (*OIDCIdentity) SetIDTokenClaims

func (i *OIDCIdentity) SetIDTokenClaims(claims interface{}) (err error)

SetIDTokenClaims marshals the given claims

func (*OIDCIdentity) SetTokenSource

func (i *OIDCIdentity) SetTokenSource(source oauth2.TokenSource)

SetTokenSource to specify a test/mock token source

func (*OIDCIdentity) TokenSource

func (i *OIDCIdentity) TokenSource() oauth2.TokenSource

TokenSource getter

Jump to

Keyboard shortcuts

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