authentication

package
v0.0.0-...-44a5619 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Set provides the use-case of Authentication.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	ClientFactory    client.FactoryInterface
	Logger           logger.Interface
	Clock            clock.Interface
	AuthCodeBrowser  *authcode.Browser
	AuthCodeKeyboard *authcode.Keyboard
	ROPC             *ropc.ROPC
}

Authentication provides the internal use-case of authentication.

If the IDToken is not set, it performs the authentication flow. If the IDToken is valid, it does nothing. If the IDtoken has expired and the RefreshToken is set, it refreshes the token. If the RefreshToken has expired, it performs the authentication flow.

The authentication flow is determined as:

If the Username is not set, it performs the authorization code flow. Otherwise, it performs the resource owner password credentials flow. If the Password is not set, it asks a password by the prompt.

func (*Authentication) Do

func (u *Authentication) Do(ctx context.Context, in Input) (*Output, error)

type GrantOptionSet

type GrantOptionSet struct {
	AuthCodeBrowserOption  *authcode.BrowserOption
	AuthCodeKeyboardOption *authcode.KeyboardOption
	ROPCOption             *ropc.Option
}

type Input

type Input struct {
	Provider        oidc.Provider
	GrantOptionSet  GrantOptionSet
	CachedTokenSet  *oidc.TokenSet // optional
	TLSClientConfig tlsclientconfig.Config
}

Input represents an input DTO of the Authentication use-case.

type Interface

type Interface interface {
	Do(ctx context.Context, in Input) (*Output, error)
}

type MockInterface

type MockInterface struct {
	mock.Mock
}

MockInterface is an autogenerated mock type for the Interface type

func NewMockInterface

func NewMockInterface(t mockConstructorTestingTNewMockInterface) *MockInterface

NewMockInterface creates a new instance of MockInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInterface) Do

func (_m *MockInterface) Do(ctx context.Context, in Input) (*Output, error)

Do provides a mock function with given fields: ctx, in

func (*MockInterface) EXPECT

func (_m *MockInterface) EXPECT() *MockInterface_Expecter

type MockInterface_Do_Call

type MockInterface_Do_Call struct {
	*mock.Call
}

MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do'

func (*MockInterface_Do_Call) Return

func (*MockInterface_Do_Call) Run

func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in Input)) *MockInterface_Do_Call

type MockInterface_Expecter

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

func (*MockInterface_Expecter) Do

func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call

Do is a helper method to define mock.On call

  • ctx context.Context
  • in Input

type Output

type Output struct {
	AlreadyHasValidIDToken bool
	TokenSet               oidc.TokenSet
}

Output represents an output DTO of the Authentication use-case.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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