Temporary disabling exchange for offline token since with new keycloak original token should be issued with `offline` scope to work and has still to be inroduced the possibility to do it
This commit is contained in:
parent
49af6590f7
commit
899cf13afd
|
@ -405,7 +405,7 @@ public class DefaultKeycloakClient implements KeycloakClient {
|
|||
params.put(GRANT_TYPE_PARAMETER, Arrays.asList(PASSWORD_GRANT_TYPE));
|
||||
params.put(USERNAME_PARAMETER, Arrays.asList(username));
|
||||
params.put(PASSWORD_PARAMETER, Arrays.asList(password));
|
||||
params.put(SCOPE_PARAMETER, Arrays.asList("openid profile " + OFFLINE_ACCESS_SCOPE));
|
||||
// params.put(SCOPE_PARAMETER, Arrays.asList("openid profile " + OFFLINE_ACCESS_SCOPE));
|
||||
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
logger.debug("Adding authorization header as: {}", authorization);
|
||||
|
|
|
@ -647,8 +647,8 @@ public interface KeycloakClient {
|
|||
TokenResponse exchangeTokenForRefreshToken(String context, String oidcAccessToken, String clientId,
|
||||
String clientSecret, String audience) throws KeycloakClientException;
|
||||
|
||||
TokenResponse exchangeTokenForOfflineToken(URL tokenURL, String oidcAccessToken, String clientId,
|
||||
String clientSecret, String audience) throws IllegalArgumentException, KeycloakClientException;
|
||||
// TokenResponse exchangeTokenForOfflineToken(URL tokenURL, String oidcAccessToken, String clientId,
|
||||
// String clientSecret, String audience) throws IllegalArgumentException, KeycloakClientException;
|
||||
|
||||
TokenResponse exchangeTokenForOfflineToken(String context, String oidcAccessToken, String clientId,
|
||||
String clientSecret, String audience) throws IllegalArgumentException, KeycloakClientException;
|
||||
|
|
|
@ -507,27 +507,27 @@ public class TestKeycloakClient {
|
|||
client.introspectAccessToken(DEV_ROOT_CONTEXT, CLIENT_ID, CLIENT_SECRET, exchangedTR.getAccessToken()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test53ExchangeToken4Offline() throws Exception {
|
||||
logger.info("*** [5.3] Start testing token exchange for offline token from Keycloak...");
|
||||
KeycloakClient client = KeycloakClientFactory.newInstance();
|
||||
TokenResponse oidcTR = client.queryOIDCTokenOfUser(DEV_ROOT_CONTEXT, CLIENT_ID, CLIENT_SECRET,
|
||||
TEST_USER_USERNAME, TEST_USER_PASSWORD);
|
||||
|
||||
logger.info("*** [5.3] OIDC access token: {}", oidcTR.getAccessToken());
|
||||
|
||||
TokenResponse exchangedTR = client.exchangeTokenForOfflineToken(DEV_ROOT_CONTEXT, oidcTR.getAccessToken(),
|
||||
CLIENT_ID, CLIENT_SECRET, CLIENT_ID);
|
||||
|
||||
logger.info("*** [5.3] Exchanged access token: {}", exchangedTR.getAccessToken());
|
||||
logger.info("*** [5.3] Exchanged refresh token: {}", exchangedTR.getRefreshToken());
|
||||
TestModelUtils.checkTokenResponse(exchangedTR, true);
|
||||
TestModelUtils.checkOfflineToken(exchangedTR);
|
||||
|
||||
TestModelUtils.checkTokenIntrospectionResponse(client.introspectAccessToken(DEV_ROOT_CONTEXT, CLIENT_ID,
|
||||
CLIENT_SECRET, exchangedTR.getAccessToken()));
|
||||
|
||||
}
|
||||
// @Test
|
||||
// public void test53ExchangeToken4Offline() throws Exception {
|
||||
// logger.info("*** [5.3] Start testing token exchange for offline token from Keycloak...");
|
||||
// KeycloakClient client = KeycloakClientFactory.newInstance();
|
||||
// TokenResponse oidcTR = client.queryOIDCTokenOfUser(DEV_ROOT_CONTEXT, CLIENT_ID, CLIENT_SECRET,
|
||||
// TEST_USER_USERNAME, TEST_USER_PASSWORD);
|
||||
//
|
||||
// logger.info("*** [5.3] OIDC access token: {}", oidcTR.getAccessToken());
|
||||
//
|
||||
// TokenResponse exchangedTR = client.exchangeTokenForOfflineToken(DEV_ROOT_CONTEXT, oidcTR.getAccessToken(),
|
||||
// CLIENT_ID, CLIENT_SECRET, CLIENT_ID);
|
||||
//
|
||||
// logger.info("*** [5.3] Exchanged access token: {}", exchangedTR.getAccessToken());
|
||||
// logger.info("*** [5.3] Exchanged refresh token: {}", exchangedTR.getRefreshToken());
|
||||
// TestModelUtils.checkTokenResponse(exchangedTR, true);
|
||||
// TestModelUtils.checkOfflineToken(exchangedTR);
|
||||
//
|
||||
// TestModelUtils.checkTokenIntrospectionResponse(client.introspectAccessToken(DEV_ROOT_CONTEXT, CLIENT_ID,
|
||||
// CLIENT_SECRET, exchangedTR.getAccessToken()));
|
||||
//
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void test6GetAvatar() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue