* feat(op): dynamic issuer depending on request / host BREAKING CHANGE: The OpenID Provider package is now able to handle multiple issuers with a single storage implementation. The issuer will be selected from the host of the request and passed into the context, where every function can read it from if necessary. This results in some fundamental changes: - `Configuration` interface: - `Issuer() string` has been changed to `IssuerFromRequest(r *http.Request) string` - `Insecure() bool` has been added - OpenIDProvider interface and dependants: - `Issuer` has been removed from Config struct - `NewOpenIDProvider` now takes an additional parameter `issuer` and returns a pointer to the public/default implementation and not an OpenIDProvider interface: `NewOpenIDProvider(ctx context.Context, config *Config, storage Storage, opOpts ...Option) (OpenIDProvider, error)` changed to `NewOpenIDProvider(ctx context.Context, issuer string, config *Config, storage Storage, opOpts ...Option) (*Provider, error)` - therefore the parameter type Option changed to the public type as well: `Option func(o *Provider) error` - `AuthCallbackURL(o OpenIDProvider) func(string) string` has been changed to `AuthCallbackURL(o OpenIDProvider) func(context.Context, string) string` - `IDTokenHintVerifier() IDTokenHintVerifier` (Authorizer, OpenIDProvider, SessionEnder interfaces), `AccessTokenVerifier() AccessTokenVerifier` (Introspector, OpenIDProvider, Revoker, UserinfoProvider interfaces) and `JWTProfileVerifier() JWTProfileVerifier` (IntrospectorJWTProfile, JWTAuthorizationGrantExchanger, OpenIDProvider, RevokerJWTProfile interfaces) now take a context.Context parameter `IDTokenHintVerifier(context.Context) IDTokenHintVerifier`, `AccessTokenVerifier(context.Context) AccessTokenVerifier` and `JWTProfileVerifier(context.Context) JWTProfileVerifier` - `OidcDevMode` (CAOS_OIDC_DEV) environment variable check has been removed, use `WithAllowInsecure()` Option - Signing: the signer is not kept in memory anymore, but created on request from the loaded key: - `Signer` interface and func `NewSigner` have been removed - `ReadySigner(s Signer) ProbesFn` has been removed - `CreateDiscoveryConfig(c Configuration, s Signer) *oidc.DiscoveryConfiguration` has been changed to `CreateDiscoveryConfig(r *http.Request, config Configuration, storage DiscoverStorage) *oidc.DiscoveryConfiguration` - `Storage` interface: - `GetSigningKey(context.Context, chan<- jose.SigningKey)` has been changed to `SigningKey(context.Context) (SigningKey, error)` - `KeySet(context.Context) ([]Key, error)` has been added - `GetKeySet(context.Context) (*jose.JSONWebKeySet, error)` has been changed to `KeySet(context.Context) ([]Key, error)` - `SigAlgorithms(s Signer) []string` has been changed to `SigAlgorithms(ctx context.Context, storage DiscoverStorage) []string` - KeyProvider interface: `GetKeySet(context.Context) (*jose.JSONWebKeySet, error)` has been changed to `KeySet(context.Context) ([]Key, error)` - `CreateIDToken`: the Signer parameter has been removed * move example * fix examples * fix mocks * update readme * fix examples and update usage * update go module version to v2 * build branch * fix(module): rename caos to zitadel * fix: add state in access token response (implicit flow) * fix: encode auth response correctly (when using query in redirect uri) * fix query param handling * feat: add all optional claims of the introspection response * fix: use default redirect uri when not passed * fix: exchange cors library and add `X-Requested-With` to Access-Control-Request-Headers (#261) * feat(op): add support for client credentials * fix mocks and test * feat: allow to specify token type of JWT Profile Grant * document JWTProfileTokenStorage * cleanup * rp: fix integration test test username needed to be suffixed by issuer domain * chore(deps): bump golang.org/x/text from 0.5.0 to 0.6.0 Bumps [golang.org/x/text](https://github.com/golang/text) from 0.5.0 to 0.6.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.5.0...v0.6.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * op: mock: cleanup commented code * op: remove duplicate code code duplication caused by merge conflict selections --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: adlerhurst <silvan.reusser@gmail.com> Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
261 lines
8.8 KiB
Go
261 lines
8.8 KiB
Go
// Code generated by MockGen. DO NOT EDIT.
|
|
// Source: github.com/zitadel/oidc/v2/pkg/op (interfaces: Client)
|
|
|
|
// Package mock is a generated GoMock package.
|
|
package mock
|
|
|
|
import (
|
|
reflect "reflect"
|
|
time "time"
|
|
|
|
gomock "github.com/golang/mock/gomock"
|
|
oidc "github.com/zitadel/oidc/v2/pkg/oidc"
|
|
op "github.com/zitadel/oidc/v2/pkg/op"
|
|
)
|
|
|
|
// MockClient is a mock of Client interface.
|
|
type MockClient struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockClientMockRecorder
|
|
}
|
|
|
|
// MockClientMockRecorder is the mock recorder for MockClient.
|
|
type MockClientMockRecorder struct {
|
|
mock *MockClient
|
|
}
|
|
|
|
// NewMockClient creates a new mock instance.
|
|
func NewMockClient(ctrl *gomock.Controller) *MockClient {
|
|
mock := &MockClient{ctrl: ctrl}
|
|
mock.recorder = &MockClientMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockClient) EXPECT() *MockClientMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// AccessTokenType mocks base method.
|
|
func (m *MockClient) AccessTokenType() op.AccessTokenType {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "AccessTokenType")
|
|
ret0, _ := ret[0].(op.AccessTokenType)
|
|
return ret0
|
|
}
|
|
|
|
// AccessTokenType indicates an expected call of AccessTokenType.
|
|
func (mr *MockClientMockRecorder) AccessTokenType() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AccessTokenType", reflect.TypeOf((*MockClient)(nil).AccessTokenType))
|
|
}
|
|
|
|
// ApplicationType mocks base method.
|
|
func (m *MockClient) ApplicationType() op.ApplicationType {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ApplicationType")
|
|
ret0, _ := ret[0].(op.ApplicationType)
|
|
return ret0
|
|
}
|
|
|
|
// ApplicationType indicates an expected call of ApplicationType.
|
|
func (mr *MockClientMockRecorder) ApplicationType() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApplicationType", reflect.TypeOf((*MockClient)(nil).ApplicationType))
|
|
}
|
|
|
|
// AuthMethod mocks base method.
|
|
func (m *MockClient) AuthMethod() oidc.AuthMethod {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "AuthMethod")
|
|
ret0, _ := ret[0].(oidc.AuthMethod)
|
|
return ret0
|
|
}
|
|
|
|
// AuthMethod indicates an expected call of AuthMethod.
|
|
func (mr *MockClientMockRecorder) AuthMethod() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthMethod", reflect.TypeOf((*MockClient)(nil).AuthMethod))
|
|
}
|
|
|
|
// ClockSkew mocks base method.
|
|
func (m *MockClient) ClockSkew() time.Duration {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ClockSkew")
|
|
ret0, _ := ret[0].(time.Duration)
|
|
return ret0
|
|
}
|
|
|
|
// ClockSkew indicates an expected call of ClockSkew.
|
|
func (mr *MockClientMockRecorder) ClockSkew() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClockSkew", reflect.TypeOf((*MockClient)(nil).ClockSkew))
|
|
}
|
|
|
|
// DevMode mocks base method.
|
|
func (m *MockClient) DevMode() bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "DevMode")
|
|
ret0, _ := ret[0].(bool)
|
|
return ret0
|
|
}
|
|
|
|
// DevMode indicates an expected call of DevMode.
|
|
func (mr *MockClientMockRecorder) DevMode() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DevMode", reflect.TypeOf((*MockClient)(nil).DevMode))
|
|
}
|
|
|
|
// GetID mocks base method.
|
|
func (m *MockClient) GetID() string {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "GetID")
|
|
ret0, _ := ret[0].(string)
|
|
return ret0
|
|
}
|
|
|
|
// GetID indicates an expected call of GetID.
|
|
func (mr *MockClientMockRecorder) GetID() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetID", reflect.TypeOf((*MockClient)(nil).GetID))
|
|
}
|
|
|
|
// GrantTypes mocks base method.
|
|
func (m *MockClient) GrantTypes() []oidc.GrantType {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "GrantTypes")
|
|
ret0, _ := ret[0].([]oidc.GrantType)
|
|
return ret0
|
|
}
|
|
|
|
// GrantTypes indicates an expected call of GrantTypes.
|
|
func (mr *MockClientMockRecorder) GrantTypes() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GrantTypes", reflect.TypeOf((*MockClient)(nil).GrantTypes))
|
|
}
|
|
|
|
// IDTokenLifetime mocks base method.
|
|
func (m *MockClient) IDTokenLifetime() time.Duration {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "IDTokenLifetime")
|
|
ret0, _ := ret[0].(time.Duration)
|
|
return ret0
|
|
}
|
|
|
|
// IDTokenLifetime indicates an expected call of IDTokenLifetime.
|
|
func (mr *MockClientMockRecorder) IDTokenLifetime() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IDTokenLifetime", reflect.TypeOf((*MockClient)(nil).IDTokenLifetime))
|
|
}
|
|
|
|
// IDTokenUserinfoClaimsAssertion mocks base method.
|
|
func (m *MockClient) IDTokenUserinfoClaimsAssertion() bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "IDTokenUserinfoClaimsAssertion")
|
|
ret0, _ := ret[0].(bool)
|
|
return ret0
|
|
}
|
|
|
|
// IDTokenUserinfoClaimsAssertion indicates an expected call of IDTokenUserinfoClaimsAssertion.
|
|
func (mr *MockClientMockRecorder) IDTokenUserinfoClaimsAssertion() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IDTokenUserinfoClaimsAssertion", reflect.TypeOf((*MockClient)(nil).IDTokenUserinfoClaimsAssertion))
|
|
}
|
|
|
|
// IsScopeAllowed mocks base method.
|
|
func (m *MockClient) IsScopeAllowed(arg0 string) bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "IsScopeAllowed", arg0)
|
|
ret0, _ := ret[0].(bool)
|
|
return ret0
|
|
}
|
|
|
|
// IsScopeAllowed indicates an expected call of IsScopeAllowed.
|
|
func (mr *MockClientMockRecorder) IsScopeAllowed(arg0 interface{}) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsScopeAllowed", reflect.TypeOf((*MockClient)(nil).IsScopeAllowed), arg0)
|
|
}
|
|
|
|
// LoginURL mocks base method.
|
|
func (m *MockClient) LoginURL(arg0 string) string {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "LoginURL", arg0)
|
|
ret0, _ := ret[0].(string)
|
|
return ret0
|
|
}
|
|
|
|
// LoginURL indicates an expected call of LoginURL.
|
|
func (mr *MockClientMockRecorder) LoginURL(arg0 interface{}) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LoginURL", reflect.TypeOf((*MockClient)(nil).LoginURL), arg0)
|
|
}
|
|
|
|
// PostLogoutRedirectURIs mocks base method.
|
|
func (m *MockClient) PostLogoutRedirectURIs() []string {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "PostLogoutRedirectURIs")
|
|
ret0, _ := ret[0].([]string)
|
|
return ret0
|
|
}
|
|
|
|
// PostLogoutRedirectURIs indicates an expected call of PostLogoutRedirectURIs.
|
|
func (mr *MockClientMockRecorder) PostLogoutRedirectURIs() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PostLogoutRedirectURIs", reflect.TypeOf((*MockClient)(nil).PostLogoutRedirectURIs))
|
|
}
|
|
|
|
// RedirectURIs mocks base method.
|
|
func (m *MockClient) RedirectURIs() []string {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "RedirectURIs")
|
|
ret0, _ := ret[0].([]string)
|
|
return ret0
|
|
}
|
|
|
|
// RedirectURIs indicates an expected call of RedirectURIs.
|
|
func (mr *MockClientMockRecorder) RedirectURIs() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RedirectURIs", reflect.TypeOf((*MockClient)(nil).RedirectURIs))
|
|
}
|
|
|
|
// ResponseTypes mocks base method.
|
|
func (m *MockClient) ResponseTypes() []oidc.ResponseType {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ResponseTypes")
|
|
ret0, _ := ret[0].([]oidc.ResponseType)
|
|
return ret0
|
|
}
|
|
|
|
// ResponseTypes indicates an expected call of ResponseTypes.
|
|
func (mr *MockClientMockRecorder) ResponseTypes() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResponseTypes", reflect.TypeOf((*MockClient)(nil).ResponseTypes))
|
|
}
|
|
|
|
// RestrictAdditionalAccessTokenScopes mocks base method.
|
|
func (m *MockClient) RestrictAdditionalAccessTokenScopes() func([]string) []string {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "RestrictAdditionalAccessTokenScopes")
|
|
ret0, _ := ret[0].(func([]string) []string)
|
|
return ret0
|
|
}
|
|
|
|
// RestrictAdditionalAccessTokenScopes indicates an expected call of RestrictAdditionalAccessTokenScopes.
|
|
func (mr *MockClientMockRecorder) RestrictAdditionalAccessTokenScopes() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RestrictAdditionalAccessTokenScopes", reflect.TypeOf((*MockClient)(nil).RestrictAdditionalAccessTokenScopes))
|
|
}
|
|
|
|
// RestrictAdditionalIdTokenScopes mocks base method.
|
|
func (m *MockClient) RestrictAdditionalIdTokenScopes() func([]string) []string {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "RestrictAdditionalIdTokenScopes")
|
|
ret0, _ := ret[0].(func([]string) []string)
|
|
return ret0
|
|
}
|
|
|
|
// RestrictAdditionalIdTokenScopes indicates an expected call of RestrictAdditionalIdTokenScopes.
|
|
func (mr *MockClientMockRecorder) RestrictAdditionalIdTokenScopes() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RestrictAdditionalIdTokenScopes", reflect.TypeOf((*MockClient)(nil).RestrictAdditionalIdTokenScopes))
|
|
}
|