Skip to content

Commit

Permalink
[ELY-1150] - Revisit branches in handleOne method in ServerAuthentica…
Browse files Browse the repository at this point in the history
…tionContext.createCallbackHandler()
  • Loading branch information
pedroigor committed Jun 7, 2017
1 parent 93eee3e commit d0ca39f
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ private void handleOne(final Callback[] callbacks, final int idx) throws IOExcep
EvidenceVerifyCallback evidenceVerifyCallback = (EvidenceVerifyCallback) callback;

evidenceVerifyCallback.setVerified(verifyEvidence(evidenceVerifyCallback.getEvidence()));

handleOne(callbacks, idx + 1);
} else if (callback instanceof SSLCallback) {
SSLCallback sslCallback = (SSLCallback) callback;

Expand Down Expand Up @@ -1005,6 +1007,7 @@ private void handleOne(final Callback[] callbacks, final int idx) throws IOExcep
mi.getMechanismType(), mi.getMechanismName(), mi.getHostName(), mi.getProtocol());
}
setMechanismInformation(mi);
handleOne(callbacks, idx + 1);
} catch (Exception e) {
throw new IOException(e);
}
Expand All @@ -1018,12 +1021,11 @@ private void handleOne(final Callback[] callbacks, final int idx) throws IOExcep
authorizeCallback.setSecurityDomain(stateRef.get().getSecurityDomain());
SecurityIdentity authorizedIdentity = null;
Principal principal = null;
try {
SecurityIdentity identity = authorizeCallback.getIdentity();
if (identity != null && importIdentity(identity)) {
authorizedIdentity = getAuthorizedIdentity();
return;
}
SecurityIdentity identity = authorizeCallback.getIdentity();
if (identity != null && importIdentity(identity)) {
authorizedIdentity = getAuthorizedIdentity();
}
if (authorizedIdentity == null) {
principal = authorizeCallback.getPrincipal();
if (principal == null) {
principal = authorizeCallback.getAuthorizationPrincipal();
Expand All @@ -1032,12 +1034,11 @@ private void handleOne(final Callback[] callbacks, final int idx) throws IOExcep
setAuthenticationPrincipal(principal);
authorize();
authorizedIdentity = getAuthorizedIdentity();
return;
}
} finally {
log.tracef("Handling CachedIdentityAuthorizeCallback: principal = %s authorizedIdentity = %s", principal, authorizedIdentity);
authorizeCallback.setAuthorized(authorizedIdentity);
}
log.tracef("Handling CachedIdentityAuthorizeCallback: principal = %s authorizedIdentity = %s", principal, authorizedIdentity);
authorizeCallback.setAuthorized(authorizedIdentity);
handleOne(callbacks, idx + 1);
} else if (callback instanceof IdentityCredentialCallback) {
IdentityCredentialCallback icc = (IdentityCredentialCallback) callback;
Credential credential = icc.getCredential();
Expand Down

0 comments on commit d0ca39f

Please sign in to comment.