Skip to content

Commit 4b02f55

Browse files
committed
fix openid flow
1 parent 853695c commit 4b02f55

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/Access/TokenAccessStorage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ std::optional<AuthResult> TokenAccessStorage::authenticateImpl(
351351
// Even though token itself may be valid (especially in case of a jwt token), authentication has just failed.
352352
if (throw_if_user_not_exists)
353353
throwNotFound(AccessEntityType::USER, credentials.getUserName(), getStorageName());
354-
else
355-
return {};
354+
355+
return {};
356356
}
357357

358358
std::shared_ptr<User> new_user;

src/Access/TokenProcessorsJWT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ bool JwksJwtProcessor::resolveAndValidate(const TokenCredentials & credentials)
388388
if (decoded_jwt.has_payload_claim(groups_claim))
389389
const_cast<TokenCredentials &>(credentials).setGroups(parseGroupsFromJsonArray(decoded_jwt.get_payload_claim(groups_claim).as_array()));
390390
else
391-
LOG_TRACE(getLogger("TokenAuthentication"), "{}: Specified groups_claim {{ not found in token, no external roles will be mapped", processor_name, groups_claim);
391+
LOG_TRACE(getLogger("TokenAuthentication"), "{}: Specified groups_claim {} not found in token, no external roles will be mapped", processor_name, groups_claim);
392392

393393
return true;
394394
}

src/Access/TokenProcessorsOpaque.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ bool OpenIdTokenProcessor::resolveAndValidate(const TokenCredentials & credentia
308308
{
309309
auto decoded_token = jwt::decode(token);
310310
user_info_json = decoded_token.get_payload_json();
311+
username = getValueByKey(user_info_json, username_claim);
311312

312313
/// TODO: Now we work only with Keycloak -- and it provides expires_at in token itself. Need to add actual token introspection logic for other OIDC providers.
313314
if (decoded_token.has_expires_at())
@@ -338,7 +339,8 @@ bool OpenIdTokenProcessor::resolveAndValidate(const TokenCredentials & credentia
338339
LOG_TRACE(getLogger("TokenAuthentication"), "{}: Failed to obtain user info", processor_name);
339340
return false;
340341
}
341-
else if (username.empty())
342+
343+
if (username.empty())
342344
{
343345
LOG_TRACE(getLogger("TokenAuthentication"), "{}: Failed to get username", processor_name);
344346
return false;

0 commit comments

Comments
 (0)