Skip to content

EA-4370 handle 400 of keycloak#153

Merged
P-Ehlert merged 1 commit intomasterfrom
EA-4370_fixValidationIssues
Jan 13, 2026
Merged

EA-4370 handle 400 of keycloak#153
P-Ehlert merged 1 commit intomasterfrom
EA-4370_fixValidationIssues

Conversation

@SrishtiSingh-eu
Copy link
Contributor

No description provided.

Comment on lines +383 to +384
private boolean isInvalidOrDisabledErrorCode(String errorCode){
return StringUtils.equalsAny(errorCode, "401_key_invalid", "401_key_disabled");
Copy link
Contributor

@P-Ehlert P-Ehlert Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused. The ticket says that Keycloak returns a 400 response for an invalid key, why not a 401?
Anyway, this change is for api-commons, but in the sources I don't see any error codes such as 401_key_invalid defined. Or is this code coming from Keycloak? If so, why don't we simply consider all 400 and 401 responses from Keycloak to be a 401 response for Entity API?

Also I looked at the api-commons-sb3 code and there we do have 401_empty_apikey and 401_missing_apikey error messages. The 401_key_disabled I didn't see. If we go with checking these 401_ error codes instead of the "real" keycloak validation response code then I propose to make the check more resilient and future proof by checking if the error code starts with 401_?

@P-Ehlert P-Ehlert merged commit 651d467 into master Jan 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants