Merge pull request #1193 from behana/master

Let admin-client acquire new token if refresh_token is stale
This commit is contained in:
Bill Burke 2015-04-29 16:33:20 -04:00
commit 10998eb35b

View file

@ -7,6 +7,7 @@ import org.keycloak.admin.client.Config;
import org.keycloak.admin.client.resource.BasicAuthFilter;
import org.keycloak.representations.AccessTokenResponse;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.core.Form;
import java.util.Calendar;
import java.util.Date;
@ -76,10 +77,13 @@ public class TokenManager {
TokenService tokenService = target.proxy(TokenService.class);
try {
AccessTokenResponse response = tokenService.refreshToken(config.getRealm(), form.asMap());
defineCurrentToken(response);
return response;
} catch (BadRequestException e) {
return grantToken();
}
}
private void setExpirationTime() {