fix: response type mapping (#426)

* fix: return authorizations on userinfo

* fix: response type mapping

* fix tests

* fix angular

* regenerate mgmt proto

* enable login link again
This commit is contained in:
Livio Amstutz 2020-07-09 15:52:20 +02:00 committed by GitHub
parent 0b012f2fa2
commit 6128c0c672
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 13246 additions and 13948 deletions

View File

@ -109,7 +109,6 @@ SystemDefaults:
- 'CODE'
GrantTypes:
- 'AUTHORIZATION_CODE'
- 'IMPLICIT'
ApplicationType: 'NATIVE'
AuthMethodType: 'AUTH_TYPE_NONE'
Owners:

View File

@ -31,7 +31,7 @@ export class AppCreateComponent implements OnInit, OnDestroy {
public oidcResponseTypes: OIDCResponseType[] = [
OIDCResponseType.OIDCRESPONSETYPE_CODE,
OIDCResponseType.OIDCRESPONSETYPE_ID_TOKEN,
OIDCResponseType.OIDCRESPONSETYPE_TOKEN,
OIDCResponseType.OIDCRESPONSETYPE_ID_TOKEN_TOKEN,
];
public oidcGrantTypes: OIDCGrantType[] = [
OIDCGrantType.OIDCGRANTTYPE_AUTHORIZATION_CODE,

View File

@ -47,7 +47,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
public oidcResponseTypes: OIDCResponseType[] = [
OIDCResponseType.OIDCRESPONSETYPE_CODE,
OIDCResponseType.OIDCRESPONSETYPE_ID_TOKEN,
OIDCResponseType.OIDCRESPONSETYPE_TOKEN,
OIDCResponseType.OIDCRESPONSETYPE_ID_TOKEN_TOKEN,
];
public oidcGrantTypes: OIDCGrantType[] = [
OIDCGrantType.OIDCGRANTTYPE_AUTHORIZATION_CODE,

View File

@ -50,7 +50,7 @@ const (
SetupUser = "SETUP"
OIDCResponseTypeCode = "CODE"
OIDCResponseTypeIDToken = "ID_TOKEN"
OIDCResponseTypeToken = "TOKEN"
OIDCResponseTypeToken = "ID_TOKEN TOKEN"
OIDCGrantTypeAuthorizationCode = "AUTHORIZATION_CODE"
OIDCGrantTypeImplicit = "IMPLICIT"
OIDCGrantTypeRefreshToken = "REFRESH_TOKEN"
@ -385,7 +385,7 @@ func getOIDCResponseType(responseType string) proj_model.OIDCResponseType {
case OIDCResponseTypeIDToken:
return proj_model.OIDCResponseTypeIDToken
case OIDCResponseTypeToken:
return proj_model.OIDCResponseTypeToken
return proj_model.OIDCResponseTypeIDTokenToken
}
return proj_model.OIDCResponseTypeCode
}

View File

@ -208,8 +208,8 @@ func oidcResponseTypesToModel(responseTypes []management.OIDCResponseType) []pro
oidcResponseTypes[i] = proj_model.OIDCResponseTypeCode
case management.OIDCResponseType_OIDCRESPONSETYPE_ID_TOKEN:
oidcResponseTypes[i] = proj_model.OIDCResponseTypeIDToken
case management.OIDCResponseType_OIDCRESPONSETYPE_TOKEN:
oidcResponseTypes[i] = proj_model.OIDCResponseTypeToken
case management.OIDCResponseType_OIDCRESPONSETYPE_ID_TOKEN_TOKEN:
oidcResponseTypes[i] = proj_model.OIDCResponseTypeIDTokenToken
}
}
@ -225,8 +225,8 @@ func oidcResponseTypesFromModel(responseTypes []proj_model.OIDCResponseType) []m
oidcResponseTypes[i] = management.OIDCResponseType_OIDCRESPONSETYPE_CODE
case proj_model.OIDCResponseTypeIDToken:
oidcResponseTypes[i] = management.OIDCResponseType_OIDCRESPONSETYPE_ID_TOKEN
case proj_model.OIDCResponseTypeToken:
oidcResponseTypes[i] = management.OIDCResponseType_OIDCRESPONSETYPE_TOKEN
case proj_model.OIDCResponseTypeIDTokenToken:
oidcResponseTypes[i] = management.OIDCResponseType_OIDCRESPONSETYPE_ID_TOKEN_TOKEN
}
}

View File

@ -193,10 +193,10 @@ func ResponseTypeToBusiness(responseType oidc.ResponseType) model.OIDCResponseTy
switch responseType {
case oidc.ResponseTypeCode:
return model.OIDCResponseTypeCode
case oidc.ResponseTypeIDToken:
return model.OIDCResponseTypeIdToken
case oidc.ResponseTypeIDTokenOnly:
return model.OIDCResponseTypeToken
return model.OIDCResponseTypeIdToken
case oidc.ResponseTypeIDToken:
return model.OIDCResponseTypeIdTokenToken
default:
return model.OIDCResponseTypeCode
}
@ -206,7 +206,7 @@ func ResponseTypeToOIDC(responseType model.OIDCResponseType) oidc.ResponseType {
switch responseType {
case model.OIDCResponseTypeCode:
return oidc.ResponseTypeCode
case model.OIDCResponseTypeToken:
case model.OIDCResponseTypeIdTokenToken:
return oidc.ResponseTypeIDToken
case model.OIDCResponseTypeIdToken:
return oidc.ResponseTypeIDTokenOnly

View File

@ -50,5 +50,5 @@ type OIDCResponseType int32
const (
OIDCResponseTypeCode OIDCResponseType = iota
OIDCResponseTypeIdToken
OIDCResponseTypeToken
OIDCResponseTypeIdTokenToken
)

View File

@ -87,7 +87,7 @@ func TestApplicationValid(t *testing.T) {
Name: "Name",
Type: AppTypeOIDC,
OIDCConfig: &OIDCConfig{
ResponseTypes: []OIDCResponseType{OIDCResponseTypeToken},
ResponseTypes: []OIDCResponseType{OIDCResponseTypeIDTokenToken},
GrantTypes: []OIDCGrantType{OIDCGrantTypeImplicit},
},
},
@ -103,7 +103,7 @@ func TestApplicationValid(t *testing.T) {
Name: "Name",
Type: AppTypeOIDC,
OIDCConfig: &OIDCConfig{
ResponseTypes: []OIDCResponseType{OIDCResponseTypeToken},
ResponseTypes: []OIDCResponseType{OIDCResponseTypeIDTokenToken},
GrantTypes: []OIDCGrantType{OIDCGrantTypeAuthorizationCode},
},
},
@ -135,7 +135,7 @@ func TestApplicationValid(t *testing.T) {
Name: "Name",
Type: AppTypeOIDC,
OIDCConfig: &OIDCConfig{
ResponseTypes: []OIDCResponseType{OIDCResponseTypeCode, OIDCResponseTypeToken},
ResponseTypes: []OIDCResponseType{OIDCResponseTypeCode, OIDCResponseTypeIDTokenToken},
GrantTypes: []OIDCGrantType{OIDCGrantTypeAuthorizationCode, OIDCGrantTypeImplicit},
},
},
@ -151,7 +151,7 @@ func TestApplicationValid(t *testing.T) {
Name: "Name",
Type: AppTypeOIDC,
OIDCConfig: &OIDCConfig{
ResponseTypes: []OIDCResponseType{OIDCResponseTypeCode, OIDCResponseTypeIDToken, OIDCResponseTypeToken},
ResponseTypes: []OIDCResponseType{OIDCResponseTypeCode, OIDCResponseTypeIDToken, OIDCResponseTypeIDTokenToken},
GrantTypes: []OIDCGrantType{OIDCGrantTypeAuthorizationCode, OIDCGrantTypeImplicit},
},
},

View File

@ -24,7 +24,7 @@ type OIDCResponseType int32
const (
OIDCResponseTypeCode OIDCResponseType = iota
OIDCResponseTypeIDToken
OIDCResponseTypeToken
OIDCResponseTypeIDTokenToken
)
type OIDCGrantType int32
@ -69,7 +69,7 @@ func (c *OIDCConfig) getRequiredGrantTypes() []OIDCGrantType {
switch r {
case OIDCResponseTypeCode:
grantTypes = append(grantTypes, OIDCGrantTypeAuthorizationCode)
case OIDCResponseTypeIDToken, OIDCResponseTypeToken:
case OIDCResponseTypeIDToken, OIDCResponseTypeIDTokenToken:
if !implicit {
grantTypes = append(grantTypes, OIDCGrantTypeImplicit)
}

View File

@ -21,7 +21,7 @@
<div class="actions">
<button class="primary right" type="submit">{{t "Actions.Next"}}</button>
<button class="secondary right" href="{{ registerUrl .AuthReqID }}" >{{t "Actions.Register"}}</button>
<button class="secondary right" href="{{ registerUrl .AuthReqID }}" formnovalidate>{{t "Actions.Register"}}</button>
</div>
</form>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2201,7 +2201,7 @@ message OIDCConfigUpdate {
enum OIDCResponseType {
OIDCRESPONSETYPE_CODE = 0;
OIDCRESPONSETYPE_ID_TOKEN = 1;
OIDCRESPONSETYPE_TOKEN = 2;
OIDCRESPONSETYPE_ID_TOKEN_TOKEN = 2;
}
enum OIDCGrantType {