Documentation
¶
Index ¶
- type Client
- type ExchangeAuthCodeInput
- type Factory
- type FactoryClient
- type GetAuthCodeURLInput
- type GetTokenByAuthCodeInput
- type MockClient
- func (_m *MockClient) EXPECT() *MockClient_Expecter
- func (_m *MockClient) ExchangeAuthCode(ctx context.Context, in ExchangeAuthCodeInput) (*TokenSet, error)
- func (_m *MockClient) GetAuthCodeURL(ctx context.Context, in GetAuthCodeURLInput) (string, error)
- func (_m *MockClient) GetTokenByAuthCode(ctx context.Context, in GetTokenByAuthCodeInput, ...) (*TokenSet, error)
- func (_m *MockClient) Logout(idToken string) error
- func (_m *MockClient) Refresh(ctx context.Context, refreshToken string) (*TokenSet, error)
- type MockClient_ExchangeAuthCode_Call
- func (_c *MockClient_ExchangeAuthCode_Call) Return(_a0 *TokenSet, _a1 error) *MockClient_ExchangeAuthCode_Call
- func (_c *MockClient_ExchangeAuthCode_Call) Run(run func(ctx context.Context, in ExchangeAuthCodeInput)) *MockClient_ExchangeAuthCode_Call
- func (_c *MockClient_ExchangeAuthCode_Call) RunAndReturn(run func(context.Context, ExchangeAuthCodeInput) (*TokenSet, error)) *MockClient_ExchangeAuthCode_Call
- type MockClient_Expecter
- func (_e *MockClient_Expecter) ExchangeAuthCode(ctx interface{}, in interface{}) *MockClient_ExchangeAuthCode_Call
- func (_e *MockClient_Expecter) GetAuthCodeURL(ctx interface{}, in interface{}) *MockClient_GetAuthCodeURL_Call
- func (_e *MockClient_Expecter) GetTokenByAuthCode(ctx interface{}, in interface{}, localServerReadyChan interface{}) *MockClient_GetTokenByAuthCode_Call
- func (_e *MockClient_Expecter) Logout(idToken interface{}) *MockClient_Logout_Call
- func (_e *MockClient_Expecter) Refresh(ctx interface{}, refreshToken interface{}) *MockClient_Refresh_Call
- type MockClient_GetAuthCodeURL_Call
- func (_c *MockClient_GetAuthCodeURL_Call) Return(_a0 string, _a1 error) *MockClient_GetAuthCodeURL_Call
- func (_c *MockClient_GetAuthCodeURL_Call) Run(run func(ctx context.Context, in GetAuthCodeURLInput)) *MockClient_GetAuthCodeURL_Call
- func (_c *MockClient_GetAuthCodeURL_Call) RunAndReturn(run func(context.Context, GetAuthCodeURLInput) (string, error)) *MockClient_GetAuthCodeURL_Call
- type MockClient_GetTokenByAuthCode_Call
- func (_c *MockClient_GetTokenByAuthCode_Call) Return(_a0 *TokenSet, _a1 error) *MockClient_GetTokenByAuthCode_Call
- func (_c *MockClient_GetTokenByAuthCode_Call) Run(run func(ctx context.Context, in GetTokenByAuthCodeInput, ...)) *MockClient_GetTokenByAuthCode_Call
- func (_c *MockClient_GetTokenByAuthCode_Call) RunAndReturn(...) *MockClient_GetTokenByAuthCode_Call
- type MockClient_Logout_Call
- type MockClient_Refresh_Call
- func (_c *MockClient_Refresh_Call) Return(_a0 *TokenSet, _a1 error) *MockClient_Refresh_Call
- func (_c *MockClient_Refresh_Call) Run(run func(ctx context.Context, refreshToken string)) *MockClient_Refresh_Call
- func (_c *MockClient_Refresh_Call) RunAndReturn(run func(context.Context, string) (*TokenSet, error)) *MockClient_Refresh_Call
- type MockFactoryClient
- type MockFactoryClient_Expecter
- type MockFactoryClient_New_Call
- func (_c *MockFactoryClient_New_Call) Return(_a0 Client, _a1 error) *MockFactoryClient_New_Call
- func (_c *MockFactoryClient_New_Call) Run(run func(ctx context.Context, p Provider)) *MockFactoryClient_New_Call
- func (_c *MockFactoryClient_New_Call) RunAndReturn(run func(context.Context, Provider) (Client, error)) *MockFactoryClient_New_Call
- type MockFactoryClient_SetLogger_Call
- func (_c *MockFactoryClient_SetLogger_Call) Return() *MockFactoryClient_SetLogger_Call
- func (_c *MockFactoryClient_SetLogger_Call) Run(run func(_a0 *slog.Logger)) *MockFactoryClient_SetLogger_Call
- func (_c *MockFactoryClient_SetLogger_Call) RunAndReturn(run func(*slog.Logger)) *MockFactoryClient_SetLogger_Call
- type Provider
- type TokenSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Refresh creates an updated TokenSet by means of refreshing an oauth2 token
Refresh(ctx context.Context, refreshToken string) (*TokenSet, error)
// Logout deletes the session from the OIDC provider
Logout(idToken string) error
// GetTokenByAuthCode performs the Authorization Code Grant Flow and returns
GetTokenByAuthCode(ctx context.Context, in GetTokenByAuthCodeInput, localServerReadyChan chan<- string) (*TokenSet, error)
// GetAuthCodeURL returns a URL to OAuth 2.0 provider's consent page
GetAuthCodeURL(ctx context.Context, in GetAuthCodeURLInput) (string, error)
// ExchangeAuthCode converts an authorization code into a TokenSet
ExchangeAuthCode(ctx context.Context, in ExchangeAuthCodeInput) (*TokenSet, error)
}
Client represents an OIDC Client
type ExchangeAuthCodeInput ¶
type ExchangeAuthCodeInput struct {
Code string
// PKCEVerifier is the verifier used to verify the token
PKCEVerifier string
// OIDC Nonce
Nonce string
// RedirectURI is the redirect url
RedirectURI string
}
ExchangeAuthCodeInput holds the input parameters for ExchangeAuthCode()
type FactoryClient ¶
type FactoryClient interface {
/// New creates a new OIDC Client
New(ctx context.Context, p Provider) (Client, error)
// SetLogger sets the logger used for authentication
SetLogger(*slog.Logger)
}
FactoryClient represents a Client factory
type GetAuthCodeURLInput ¶
type GetAuthCodeURLInput struct {
// RedirectURI is the redirect url
// This is typicalle an URN such as urn:ietf:wg:oauth:2.0:oob
RedirectURI string
// PKCEVerifier is the verifier used to verify the token
PKCEVerifier string
// OAuth 2.0 state
State string
// OIDC Nonce
Nonce string
}
GetGetAuthCodeURL is the input given to GetAuthCodeURL
type GetTokenByAuthCodeInput ¶
type GetTokenByAuthCodeInput struct {
// BindAddress is the IP-address and port used by the redirect url server
BindAddress string
// RedirectURLHostname is the hostname of the redirect URL. You can set this
// if your provider does not accept localhost.
RedirectURLHostname string
// PKCEVerifier is the verifier used to verify the token
PKCEVerifier string
// OAuth 2.0 state
State string
// OIDC Nonce
Nonce string
}
GetTokenByAuthCodeInput is the input given to GetTokenByAuthCode
type MockClient ¶
MockClient is an autogenerated mock type for the Client type
func NewMockClient ¶
func NewMockClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockClient
NewMockClient creates a new instance of MockClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockClient) EXPECT ¶
func (_m *MockClient) EXPECT() *MockClient_Expecter
func (*MockClient) ExchangeAuthCode ¶
func (_m *MockClient) ExchangeAuthCode(ctx context.Context, in ExchangeAuthCodeInput) (*TokenSet, error)
ExchangeAuthCode provides a mock function with given fields: ctx, in
func (*MockClient) GetAuthCodeURL ¶
func (_m *MockClient) GetAuthCodeURL(ctx context.Context, in GetAuthCodeURLInput) (string, error)
GetAuthCodeURL provides a mock function with given fields: ctx, in
func (*MockClient) GetTokenByAuthCode ¶
func (_m *MockClient) GetTokenByAuthCode(ctx context.Context, in GetTokenByAuthCodeInput, localServerReadyChan chan<- string) (*TokenSet, error)
GetTokenByAuthCode provides a mock function with given fields: ctx, in, localServerReadyChan
func (*MockClient) Logout ¶
func (_m *MockClient) Logout(idToken string) error
Logout provides a mock function with given fields: idToken
type MockClient_ExchangeAuthCode_Call ¶
MockClient_ExchangeAuthCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExchangeAuthCode'
func (*MockClient_ExchangeAuthCode_Call) Return ¶
func (_c *MockClient_ExchangeAuthCode_Call) Return(_a0 *TokenSet, _a1 error) *MockClient_ExchangeAuthCode_Call
func (*MockClient_ExchangeAuthCode_Call) Run ¶
func (_c *MockClient_ExchangeAuthCode_Call) Run(run func(ctx context.Context, in ExchangeAuthCodeInput)) *MockClient_ExchangeAuthCode_Call
func (*MockClient_ExchangeAuthCode_Call) RunAndReturn ¶
func (_c *MockClient_ExchangeAuthCode_Call) RunAndReturn(run func(context.Context, ExchangeAuthCodeInput) (*TokenSet, error)) *MockClient_ExchangeAuthCode_Call
type MockClient_Expecter ¶
type MockClient_Expecter struct {
// contains filtered or unexported fields
}
func (*MockClient_Expecter) ExchangeAuthCode ¶
func (_e *MockClient_Expecter) ExchangeAuthCode(ctx interface{}, in interface{}) *MockClient_ExchangeAuthCode_Call
ExchangeAuthCode is a helper method to define mock.On call
- ctx context.Context
- in ExchangeAuthCodeInput
func (*MockClient_Expecter) GetAuthCodeURL ¶
func (_e *MockClient_Expecter) GetAuthCodeURL(ctx interface{}, in interface{}) *MockClient_GetAuthCodeURL_Call
GetAuthCodeURL is a helper method to define mock.On call
- ctx context.Context
- in GetAuthCodeURLInput
func (*MockClient_Expecter) GetTokenByAuthCode ¶
func (_e *MockClient_Expecter) GetTokenByAuthCode(ctx interface{}, in interface{}, localServerReadyChan interface{}) *MockClient_GetTokenByAuthCode_Call
GetTokenByAuthCode is a helper method to define mock.On call
- ctx context.Context
- in GetTokenByAuthCodeInput
- localServerReadyChan chan<- string
func (*MockClient_Expecter) Logout ¶
func (_e *MockClient_Expecter) Logout(idToken interface{}) *MockClient_Logout_Call
Logout is a helper method to define mock.On call
- idToken string
func (*MockClient_Expecter) Refresh ¶
func (_e *MockClient_Expecter) Refresh(ctx interface{}, refreshToken interface{}) *MockClient_Refresh_Call
Refresh is a helper method to define mock.On call
- ctx context.Context
- refreshToken string
type MockClient_GetAuthCodeURL_Call ¶
MockClient_GetAuthCodeURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAuthCodeURL'
func (*MockClient_GetAuthCodeURL_Call) Return ¶
func (_c *MockClient_GetAuthCodeURL_Call) Return(_a0 string, _a1 error) *MockClient_GetAuthCodeURL_Call
func (*MockClient_GetAuthCodeURL_Call) Run ¶
func (_c *MockClient_GetAuthCodeURL_Call) Run(run func(ctx context.Context, in GetAuthCodeURLInput)) *MockClient_GetAuthCodeURL_Call
func (*MockClient_GetAuthCodeURL_Call) RunAndReturn ¶
func (_c *MockClient_GetAuthCodeURL_Call) RunAndReturn(run func(context.Context, GetAuthCodeURLInput) (string, error)) *MockClient_GetAuthCodeURL_Call
type MockClient_GetTokenByAuthCode_Call ¶
MockClient_GetTokenByAuthCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokenByAuthCode'
func (*MockClient_GetTokenByAuthCode_Call) Return ¶
func (_c *MockClient_GetTokenByAuthCode_Call) Return(_a0 *TokenSet, _a1 error) *MockClient_GetTokenByAuthCode_Call
func (*MockClient_GetTokenByAuthCode_Call) Run ¶
func (_c *MockClient_GetTokenByAuthCode_Call) Run(run func(ctx context.Context, in GetTokenByAuthCodeInput, localServerReadyChan chan<- string)) *MockClient_GetTokenByAuthCode_Call
func (*MockClient_GetTokenByAuthCode_Call) RunAndReturn ¶
func (_c *MockClient_GetTokenByAuthCode_Call) RunAndReturn(run func(context.Context, GetTokenByAuthCodeInput, chan<- string) (*TokenSet, error)) *MockClient_GetTokenByAuthCode_Call
type MockClient_Logout_Call ¶
MockClient_Logout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Logout'
func (*MockClient_Logout_Call) Return ¶
func (_c *MockClient_Logout_Call) Return(_a0 error) *MockClient_Logout_Call
func (*MockClient_Logout_Call) Run ¶
func (_c *MockClient_Logout_Call) Run(run func(idToken string)) *MockClient_Logout_Call
func (*MockClient_Logout_Call) RunAndReturn ¶
func (_c *MockClient_Logout_Call) RunAndReturn(run func(string) error) *MockClient_Logout_Call
type MockClient_Refresh_Call ¶
MockClient_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh'
func (*MockClient_Refresh_Call) Return ¶
func (_c *MockClient_Refresh_Call) Return(_a0 *TokenSet, _a1 error) *MockClient_Refresh_Call
func (*MockClient_Refresh_Call) Run ¶
func (_c *MockClient_Refresh_Call) Run(run func(ctx context.Context, refreshToken string)) *MockClient_Refresh_Call
func (*MockClient_Refresh_Call) RunAndReturn ¶
func (_c *MockClient_Refresh_Call) RunAndReturn(run func(context.Context, string) (*TokenSet, error)) *MockClient_Refresh_Call
type MockFactoryClient ¶
MockFactoryClient is an autogenerated mock type for the FactoryClient type
func NewMockFactoryClient ¶
func NewMockFactoryClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockFactoryClient
NewMockFactoryClient creates a new instance of MockFactoryClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockFactoryClient) EXPECT ¶
func (_m *MockFactoryClient) EXPECT() *MockFactoryClient_Expecter
func (*MockFactoryClient) SetLogger ¶
func (_m *MockFactoryClient) SetLogger(_a0 *slog.Logger)
SetLogger provides a mock function with given fields: _a0
type MockFactoryClient_Expecter ¶
type MockFactoryClient_Expecter struct {
// contains filtered or unexported fields
}
func (*MockFactoryClient_Expecter) New ¶
func (_e *MockFactoryClient_Expecter) New(ctx interface{}, p interface{}) *MockFactoryClient_New_Call
New is a helper method to define mock.On call
- ctx context.Context
- p Provider
func (*MockFactoryClient_Expecter) SetLogger ¶
func (_e *MockFactoryClient_Expecter) SetLogger(_a0 interface{}) *MockFactoryClient_SetLogger_Call
SetLogger is a helper method to define mock.On call
- _a0 *slog.Logger
type MockFactoryClient_New_Call ¶
MockFactoryClient_New_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'New'
func (*MockFactoryClient_New_Call) Return ¶
func (_c *MockFactoryClient_New_Call) Return(_a0 Client, _a1 error) *MockFactoryClient_New_Call
func (*MockFactoryClient_New_Call) Run ¶
func (_c *MockFactoryClient_New_Call) Run(run func(ctx context.Context, p Provider)) *MockFactoryClient_New_Call
func (*MockFactoryClient_New_Call) RunAndReturn ¶
func (_c *MockFactoryClient_New_Call) RunAndReturn(run func(context.Context, Provider) (Client, error)) *MockFactoryClient_New_Call
type MockFactoryClient_SetLogger_Call ¶
MockFactoryClient_SetLogger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLogger'
func (*MockFactoryClient_SetLogger_Call) Return ¶
func (_c *MockFactoryClient_SetLogger_Call) Return() *MockFactoryClient_SetLogger_Call
func (*MockFactoryClient_SetLogger_Call) Run ¶
func (_c *MockFactoryClient_SetLogger_Call) Run(run func(_a0 *slog.Logger)) *MockFactoryClient_SetLogger_Call
func (*MockFactoryClient_SetLogger_Call) RunAndReturn ¶
func (_c *MockFactoryClient_SetLogger_Call) RunAndReturn(run func(*slog.Logger)) *MockFactoryClient_SetLogger_Call