keycloak-admin-client: Provide logout method to TokenService
This commit is contained in:
parent
68a07465a6
commit
c70b4eaade
2 changed files with 19 additions and 0 deletions
|
@ -126,6 +126,21 @@ public class TokenManager {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void logout() {
|
||||
if (currentToken.getRefreshToken() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Form form = new Form().param(REFRESH_TOKEN, currentToken.getRefreshToken());
|
||||
|
||||
if (config.isPublicClient()) {
|
||||
form.param(CLIENT_ID, config.getClientId());
|
||||
}
|
||||
|
||||
tokenService.logout(config.getRealm(), form.asMap());
|
||||
currentToken = null;
|
||||
}
|
||||
|
||||
public synchronized void setMinTokenValidity(long minTokenValidity) {
|
||||
this.minTokenValidity = minTokenValidity;
|
||||
}
|
||||
|
|
|
@ -42,4 +42,8 @@ public interface TokenService {
|
|||
@Path("/realms/{realm}/protocol/openid-connect/token")
|
||||
AccessTokenResponse refreshToken(@PathParam("realm") String realm, MultivaluedMap<String, String> map);
|
||||
|
||||
@POST
|
||||
@Path("/realms/{realm}/protocol/openid-connect/logout")
|
||||
void logout(@PathParam("realm") String realm, MultivaluedMap<String, String> map);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue