Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vzakharchenko committed Jul 23, 2021
1 parent 13049bb commit fc4d23c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "keycloak-lambda-authorizer",
"version": "1.0.3",
"version": "1.0.4",
"description": "Keycloak Cloud Adapter",
"main": "index.js",
"homepage": "https://github.com/vzakharchenko/keycloak-lambda-authorizer",
Expand Down
10 changes: 5 additions & 5 deletions src/clients/ClientAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ export class DefaultClientAuthorization implements ClientAuthorization {
if (isExpired(decodedRefreshToken)) {
return null;
}
const requestContent = transformResfreshToRequest(refreshContext);
if (!decodedAccessToken || isExpired(decodedAccessToken)) {
const requestContent = transformResfreshToRequest(refreshContext);
const keycloakJson = await this.options.keycloakJson(this.options, requestContent);
const realmName = keycloakJson.realm;
const umaConfig = await this.options.umaConfiguration.getUma2Configuration(requestContent);
Expand All @@ -225,15 +225,15 @@ export class DefaultClientAuthorization implements ClientAuthorization {
data,
{'Content-Type': 'application/x-www-form-urlencoded'});
tokenJson = JSON.parse(tokenResponse);
const enforcer = enforcerFunc ? await enforcerFunc(this.options, requestContent) : null;
if (enforcer) {
await this.options.enforcer.enforce(requestContent, updateEnforce(enforcer));
}
} catch (e) {
this.options.logger.error(`wrong refresh token for ${realmName}`, e);
return null;
}
}
const enforcer = enforcerFunc ? await enforcerFunc(this.options, requestContent) : null;
if (enforcer) {
await this.options.enforcer.enforce(requestContent, updateEnforce(enforcer));
}
return {...refreshContext, ...{token: tokenJson}};
}

Expand Down

0 comments on commit fc4d23c

Please sign in to comment.