Skip to content

Commit

Permalink
[JBWS-4438]:Authentication always failed when the webservice security…
Browse files Browse the repository at this point in the history
… is configured with a custom realm
  • Loading branch information
jimma committed Jan 10, 2025
1 parent 3ba0247 commit adf5663
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ public Subject createSubject(SecurityDomainContext ctx, String name, String pass
return null;
}
RealmIdentity identity = securityDomain.getIdentity(principal.getName());
if (identity.equals(RealmIdentity.NON_EXISTENT) || identity.getCredential(PasswordCredential.class) == null) {
if (identity.equals(RealmIdentity.NON_EXISTENT)) {
throw MESSAGES.authenticationFailed(principal.getName());
}
if (isDigest && created != null && nonce != null) { // username token profile is using digest
// verify client's digest
TwoWayPassword recoveredTwoWayPassword = identity.getCredential(PasswordCredential.class).getPassword(TwoWayPassword.class);
PasswordCredential passwordCredential = identity.getCredential(PasswordCredential.class);
if (passwordCredential == null) {
throw MESSAGES.authenticationFailed(principal.getName());
}
TwoWayPassword recoveredTwoWayPassword = passwordCredential.getPassword(TwoWayPassword.class);
if (recoveredTwoWayPassword == null) {
SECURITY_LOGGER.plainTextPasswordMustBeRecoverable(principal.getName(), null);
throw MESSAGES.authenticationFailed(principal.getName());
Expand Down

0 comments on commit adf5663

Please sign in to comment.