[KEYCLOAK-7695] Restore token_type and expires_in for implicit flow

As KEYCLOAK-6585 concerns only hybrid flow, this commit restores the behavior for implicit flow.

This commit partially reverts #5041 (061049e41a6b0e6fb45c75f05748023ad7ab7d92).
This commit is contained in:
Jani 2018-06-19 21:53:28 +03:00 committed by Marek Posolda
parent 8a7a545628
commit 42553cdc44
2 changed files with 5 additions and 1 deletions

View file

@ -910,7 +910,7 @@
supportedParams = ['code', 'state', 'session_state'];
break;
case 'implicit':
supportedParams = ['access_token', 'id_token', 'state', 'session_state'];
supportedParams = ['access_token', 'token_type', 'id_token', 'state', 'session_state', 'expires_in'];
break;
case 'hybrid':
supportedParams = ['access_token', 'id_token', 'code', 'state', 'session_state'];

View file

@ -235,6 +235,10 @@ public class OIDCLoginProtocol implements LoginProtocol {
if (responseType.hasResponseType(OIDCResponseType.TOKEN)) {
redirectUri.addParam(OAuth2Constants.ACCESS_TOKEN, res.getToken());
if (responseType.isImplicitFlow()) {
redirectUri.addParam("token_type", res.getTokenType());
redirectUri.addParam("expires_in", String.valueOf(res.getExpiresIn()));
}
}
}