Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ELY-1150] - Revisit branches in handleOne method in ServerAuthenticationContext.createCallbackHandler() #862

Merged
merged 1 commit into from
Jun 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,10 @@ 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();
} else {
principal = authorizeCallback.getPrincipal();
if (principal == null) {
principal = authorizeCallback.getAuthorizationPrincipal();
Expand All @@ -1032,12 +1033,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