Added refresh token from the encoded JWT form only of the `refresh_token` function; for public client types only.
This commit is contained in:
parent
6ed1591974
commit
f7ab942a5c
|
@ -216,6 +216,16 @@ public class DefaultKeycloakClient implements KeycloakClient {
|
||||||
return refreshToken(tokenURL, clientId, clientSecret, tokenResponse.getRefreshToken());
|
return refreshToken(tokenURL, clientId, clientSecret, tokenResponse.getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TokenResponse refreshToken(String refreshTokenJWTString) throws KeycloakClientException {
|
||||||
|
try {
|
||||||
|
String clientId = ModelUtils.getClientIdFromToken(ModelUtils.getRefreshTokenFrom(refreshTokenJWTString));
|
||||||
|
return refreshToken(clientId, refreshTokenJWTString);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new KeycloakClientException("Cannot construct access token object from token response", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TokenResponse refreshToken(String clientId, String refreshTokenJWTString) throws KeycloakClientException {
|
public TokenResponse refreshToken(String clientId, String refreshTokenJWTString) throws KeycloakClientException {
|
||||||
return refreshToken(clientId, null, refreshTokenJWTString);
|
return refreshToken(clientId, null, refreshTokenJWTString);
|
||||||
|
|
|
@ -148,6 +148,18 @@ public interface KeycloakClient {
|
||||||
TokenResponse refreshToken(URL tokenURL, String clientId, String clientSecret, TokenResponse tokenResponse)
|
TokenResponse refreshToken(URL tokenURL, String clientId, String clientSecret, TokenResponse tokenResponse)
|
||||||
throws KeycloakClientException;
|
throws KeycloakClientException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refreshes a previously issued token from the Keycloak server discovered in the current scope using the the refresh token JWT encoded string obtained with the access token in the previous token response.
|
||||||
|
*
|
||||||
|
* Client id will be read from "issued for" refresh token's claim and client secret will be not sent.
|
||||||
|
* <br><b>NOTE</b>: For <code>public</code> clients types only.
|
||||||
|
*
|
||||||
|
* @param refreshTokenJWTString the previously issued refresh token JWT string taken from the same token response of the access token parameter
|
||||||
|
* @return the refreshed token as {@link TokenResponse} object
|
||||||
|
* @throws KeycloakClientException if something goes wrong performing the refresh query
|
||||||
|
*/
|
||||||
|
TokenResponse refreshToken(String refreshTokenJWTString) throws KeycloakClientException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes a previously issued token from the Keycloak server discovered in the current scope using the provided
|
* Refreshes a previously issued token from the Keycloak server discovered in the current scope using the provided
|
||||||
* client id and the refresh token JWT encoded string obtained with the access token in the previous token response.
|
* client id and the refresh token JWT encoded string obtained with the access token in the previous token response.
|
||||||
|
|
Loading…
Reference in New Issue