Set docs for client secret as mandatory, but it can be blank.
This commit is contained in:
parent
2c0c0112c6
commit
5edbce017f
2 changed files with 11 additions and 10 deletions
|
@ -42,13 +42,12 @@ type openIDPayload struct {
|
||||||
|
|
||||||
// OIDC represents an OAuth 2.0 OpenID Connect provider.
|
// OIDC represents an OAuth 2.0 OpenID Connect provider.
|
||||||
//
|
//
|
||||||
// ClientSecret is optional, and it will be only necessary if an implicit flow
|
// ClientSecret is mandatory, but it can be an empty string.
|
||||||
// is not available, the value will be visible in the provisioners endpoint.
|
|
||||||
type OIDC struct {
|
type OIDC struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
ClientID string `json:"clientID"`
|
ClientID string `json:"clientID"`
|
||||||
ClientSecret string `json:"clientSecret,omitempty"`
|
ClientSecret string `json:"clientSecret"`
|
||||||
ConfigurationEndpoint string `json:"configurationEndpoint"`
|
ConfigurationEndpoint string `json:"configurationEndpoint"`
|
||||||
Claims *Claims `json:"claims,omitempty"`
|
Claims *Claims `json:"claims,omitempty"`
|
||||||
Admins []string `json:"admins,omitempty"`
|
Admins []string `json:"admins,omitempty"`
|
||||||
|
|
|
@ -68,6 +68,7 @@ func TestOIDC_Init(t *testing.T) {
|
||||||
Type string
|
Type string
|
||||||
Name string
|
Name string
|
||||||
ClientID string
|
ClientID string
|
||||||
|
ClientSecret string
|
||||||
ConfigurationEndpoint string
|
ConfigurationEndpoint string
|
||||||
Claims *Claims
|
Claims *Claims
|
||||||
Admins []string
|
Admins []string
|
||||||
|
@ -81,13 +82,14 @@ func TestOIDC_Init(t *testing.T) {
|
||||||
args args
|
args args
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"ok", fields{"oidc", "name", "client-id", srv.URL + "/openid-configuration", nil, nil}, args{config}, false},
|
{"ok", fields{"oidc", "name", "client-id", "client-secret", srv.URL + "/openid-configuration", nil, nil}, args{config}, false},
|
||||||
{"ok-admins", fields{"oidc", "name", "client-id", srv.URL + "/openid-configuration", nil, []string{"foo@smallstep.com"}}, args{config}, false},
|
{"ok-admins", fields{"oidc", "name", "client-id", "client-secret", srv.URL + "/openid-configuration", nil, []string{"foo@smallstep.com"}}, args{config}, false},
|
||||||
{"no-name", fields{"oidc", "", "client-id", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
|
{"ok-no-secret", fields{"oidc", "name", "client-id", "", srv.URL + "/openid-configuration", nil, nil}, args{config}, false},
|
||||||
{"no-type", fields{"", "name", "client-id", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
|
{"no-name", fields{"oidc", "", "client-id", "client-secret", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
|
||||||
{"no-client-id", fields{"oidc", "name", "", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
|
{"no-type", fields{"", "name", "client-id", "client-secret", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
|
||||||
{"no-configuration", fields{"oidc", "name", "client-id", "", nil, nil}, args{config}, true},
|
{"no-client-id", fields{"oidc", "name", "", "client-secret", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
|
||||||
{"bad-configuration", fields{"oidc", "name", "client-id", srv.URL, nil, nil}, args{config}, true},
|
{"no-configuration", fields{"oidc", "name", "client-id", "client-secret", "", nil, nil}, args{config}, true},
|
||||||
|
{"bad-configuration", fields{"oidc", "name", "client-id", "client-secret", srv.URL, nil, nil}, args{config}, true},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue