SEC-1390: Added null check on claimedIdentifier returned by DiscoveryInformation to prevent NPE.

This commit is contained in:
Luke Taylor 2010-01-28 16:34:45 +00:00
parent b1243416fc
commit 8720966d20

View File

@ -158,7 +158,7 @@ public class OpenID4JavaConsumer implements OpenIDConsumer {
} }
} catch (MessageException e) { } catch (MessageException e) {
attributes.clear(); attributes.clear();
throw new OpenIDConsumerException("Attribute retrievel failed", e); throw new OpenIDConsumerException("Attribute retrieval failed", e);
} }
if (debug) { if (debug) {
logger.debug("Retrieved attributes" + attributes); logger.debug("Retrieved attributes" + attributes);
@ -169,8 +169,9 @@ public class OpenID4JavaConsumer implements OpenIDConsumer {
Identifier verified = verification.getVerifiedId(); Identifier verified = verification.getVerifiedId();
if (verified == null) { if (verified == null) {
Identifier id = discovered.getClaimedIdentifier();
return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.FAILURE, return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.FAILURE,
discovered.getClaimedIdentifier().getIdentifier(), id == null ? "Unknown" : id.getIdentifier(),
"Verification status message: [" + verification.getStatusMsg() + "]", attributes); "Verification status message: [" + verification.getStatusMsg() + "]", attributes);
} }