fixes
This commit is contained in:
parent
0ca2370d48
commit
01ff740f4e
3 changed files with 52 additions and 40 deletions
|
@ -19,7 +19,7 @@ type DiscoveryConfiguration struct {
|
||||||
CheckSessionIframe string `json:"check_session_iframe,omitempty"`
|
CheckSessionIframe string `json:"check_session_iframe,omitempty"`
|
||||||
JwksURI string `json:"jwks_uri,omitempty"`
|
JwksURI string `json:"jwks_uri,omitempty"`
|
||||||
ScopesSupported []string `json:"scopes_supported,omitempty"`
|
ScopesSupported []string `json:"scopes_supported,omitempty"`
|
||||||
ResponseTypesSupported []string `json:"response_types_supported"`
|
ResponseTypesSupported []string `json:"response_types_supported,omitempty"`
|
||||||
ResponseModesSupported []string `json:"response_modes_supported,omitempty"`
|
ResponseModesSupported []string `json:"response_modes_supported,omitempty"`
|
||||||
GrantTypesSupported []GrantType `json:"grant_types_supported,omitempty"`
|
GrantTypesSupported []GrantType `json:"grant_types_supported,omitempty"`
|
||||||
ACRValuesSupported []string `json:"acr_values_supported,omitempty"`
|
ACRValuesSupported []string `json:"acr_values_supported,omitempty"`
|
||||||
|
|
|
@ -37,7 +37,7 @@ func TestDiscover(t *testing.T) {
|
||||||
op.Discover(tt.args.w, tt.args.config)
|
op.Discover(tt.args.w, tt.args.config)
|
||||||
rec := tt.args.w.(*httptest.ResponseRecorder)
|
rec := tt.args.w.(*httptest.ResponseRecorder)
|
||||||
require.Equal(t, http.StatusOK, rec.Code)
|
require.Equal(t, http.StatusOK, rec.Code)
|
||||||
require.Equal(t, `{"issuer":"https://issuer.com"}`, rec.Body.String())
|
require.Equal(t, `{"issuer":"https://issuer.com","request_uri_parameter_supported":false}`, rec.Body.String())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,36 +199,49 @@ func Test_SubjectTypes(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_AuthMethods(t *testing.T) {
|
func Test_AuthMethodsTokenEndpoint(t *testing.T) {
|
||||||
m := mock.NewMockConfiguration(gomock.NewController(t))
|
|
||||||
type args struct {
|
type args struct {
|
||||||
c op.Configuration
|
c op.Configuration
|
||||||
}
|
}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args args
|
args args
|
||||||
want []string
|
want []oidc.AuthMethod
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"imlicit basic",
|
"none and basic",
|
||||||
args{func() op.Configuration {
|
args{func() op.Configuration {
|
||||||
|
m := mock.NewMockConfiguration(gomock.NewController(t))
|
||||||
m.EXPECT().AuthMethodPostSupported().Return(false)
|
m.EXPECT().AuthMethodPostSupported().Return(false)
|
||||||
|
m.EXPECT().AuthMethodPrivateKeyJWTSupported().Return(false)
|
||||||
return m
|
return m
|
||||||
}()},
|
}()},
|
||||||
[]string{string(oidc.AuthMethodBasic)},
|
[]oidc.AuthMethod{oidc.AuthMethodNone, oidc.AuthMethodBasic},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"basic and post",
|
"none, basic and post",
|
||||||
args{func() op.Configuration {
|
args{func() op.Configuration {
|
||||||
|
m := mock.NewMockConfiguration(gomock.NewController(t))
|
||||||
m.EXPECT().AuthMethodPostSupported().Return(true)
|
m.EXPECT().AuthMethodPostSupported().Return(true)
|
||||||
|
m.EXPECT().AuthMethodPrivateKeyJWTSupported().Return(false)
|
||||||
return m
|
return m
|
||||||
}()},
|
}()},
|
||||||
[]string{string(oidc.AuthMethodBasic), string(oidc.AuthMethodPost)},
|
[]oidc.AuthMethod{oidc.AuthMethodNone, oidc.AuthMethodBasic, oidc.AuthMethodPost},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"none, basic, post and private_key_jwt",
|
||||||
|
args{func() op.Configuration {
|
||||||
|
m := mock.NewMockConfiguration(gomock.NewController(t))
|
||||||
|
m.EXPECT().AuthMethodPostSupported().Return(true)
|
||||||
|
m.EXPECT().AuthMethodPrivateKeyJWTSupported().Return(true)
|
||||||
|
return m
|
||||||
|
}()},
|
||||||
|
[]oidc.AuthMethod{oidc.AuthMethodNone, oidc.AuthMethodBasic, oidc.AuthMethodPost, oidc.AuthMethodPrivateKeyJWT},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if got := op.AuthMethods(tt.args.c); !reflect.DeepEqual(got, tt.want) {
|
if got := op.AuthMethodsTokenEndpoint(tt.args.c); !reflect.DeepEqual(got, tt.want) {
|
||||||
t.Errorf("authMethods() = %v, want %v", got, tt.want)
|
t.Errorf("authMethods() = %v, want %v", got, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -198,36 +198,6 @@ func (mr *MockStorageMockRecorder) GetSigningKey(arg0, arg1, arg2, arg3 interfac
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSigningKey", reflect.TypeOf((*MockStorage)(nil).GetSigningKey), arg0, arg1, arg2, arg3)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSigningKey", reflect.TypeOf((*MockStorage)(nil).GetSigningKey), arg0, arg1, arg2, arg3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserinfoFromScopes mocks base method
|
|
||||||
func (m *MockStorage) GetUserinfoFromScopes(arg0 context.Context, arg1, arg2 string, arg3 []string) (oidc.UserInfo, error) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
ret := m.ctrl.Call(m, "GetUserinfoFromScopes", arg0, arg1, arg2, arg3)
|
|
||||||
ret0, _ := ret[0].(oidc.UserInfo)
|
|
||||||
ret1, _ := ret[1].(error)
|
|
||||||
return ret0, ret1
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetUserinfoFromScopes indicates an expected call of GetUserinfoFromScopes
|
|
||||||
func (mr *MockStorageMockRecorder) GetUserinfoFromScopes(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserinfoFromScopes", reflect.TypeOf((*MockStorage)(nil).GetUserinfoFromScopes), arg0, arg1, arg2, arg3)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetUserinfoFromToken mocks base method
|
|
||||||
func (m *MockStorage) GetUserinfoFromToken(arg0 context.Context, arg1, arg2, arg3 string) (oidc.UserInfo, error) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
ret := m.ctrl.Call(m, "GetUserinfoFromToken", arg0, arg1, arg2, arg3)
|
|
||||||
ret0, _ := ret[0].(oidc.UserInfo)
|
|
||||||
ret1, _ := ret[1].(error)
|
|
||||||
return ret0, ret1
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetUserinfoFromToken indicates an expected call of GetUserinfoFromToken
|
|
||||||
func (mr *MockStorageMockRecorder) GetUserinfoFromToken(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserinfoFromToken", reflect.TypeOf((*MockStorage)(nil).GetUserinfoFromToken), arg0, arg1, arg2, arg3)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Health mocks base method
|
// Health mocks base method
|
||||||
func (m *MockStorage) Health(arg0 context.Context) error {
|
func (m *MockStorage) Health(arg0 context.Context) error {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
|
@ -270,6 +240,20 @@ func (mr *MockStorageMockRecorder) SaveNewKeyPair(arg0 interface{}) *gomock.Call
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SaveNewKeyPair", reflect.TypeOf((*MockStorage)(nil).SaveNewKeyPair), arg0)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SaveNewKeyPair", reflect.TypeOf((*MockStorage)(nil).SaveNewKeyPair), arg0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetIntrospectionFromToken mocks base method
|
||||||
|
func (m *MockStorage) SetIntrospectionFromToken(arg0 context.Context, arg1 oidc.IntrospectionResponse, arg2, arg3, arg4 string) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "SetIntrospectionFromToken", arg0, arg1, arg2, arg3, arg4)
|
||||||
|
ret0, _ := ret[0].(error)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIntrospectionFromToken indicates an expected call of SetIntrospectionFromToken
|
||||||
|
func (mr *MockStorageMockRecorder) SetIntrospectionFromToken(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetIntrospectionFromToken", reflect.TypeOf((*MockStorage)(nil).SetIntrospectionFromToken), arg0, arg1, arg2, arg3, arg4)
|
||||||
|
}
|
||||||
|
|
||||||
// SetUserinfoFromScopes mocks base method
|
// SetUserinfoFromScopes mocks base method
|
||||||
func (m *MockStorage) SetUserinfoFromScopes(arg0 context.Context, arg1 oidc.UserInfoSetter, arg2, arg3 string, arg4 []string) error {
|
func (m *MockStorage) SetUserinfoFromScopes(arg0 context.Context, arg1 oidc.UserInfoSetter, arg2, arg3 string, arg4 []string) error {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
|
@ -311,3 +295,18 @@ func (mr *MockStorageMockRecorder) TerminateSession(arg0, arg1, arg2 interface{}
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TerminateSession", reflect.TypeOf((*MockStorage)(nil).TerminateSession), arg0, arg1, arg2)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TerminateSession", reflect.TypeOf((*MockStorage)(nil).TerminateSession), arg0, arg1, arg2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ValidateJWTProfileScopes mocks base method
|
||||||
|
func (m *MockStorage) ValidateJWTProfileScopes(arg0 context.Context, arg1 string, arg2 oidc.Scopes) (oidc.Scopes, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "ValidateJWTProfileScopes", arg0, arg1, arg2)
|
||||||
|
ret0, _ := ret[0].(oidc.Scopes)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateJWTProfileScopes indicates an expected call of ValidateJWTProfileScopes
|
||||||
|
func (mr *MockStorageMockRecorder) ValidateJWTProfileScopes(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateJWTProfileScopes", reflect.TypeOf((*MockStorage)(nil).ValidateJWTProfileScopes), arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue