use of org.pac4j.openid.profile.yahoo.YahooOpenIdProfile in project pac4j by pac4j.
the class RunYahooOpenIdClient method verifyProfile.
@Override
protected void verifyProfile(CommonProfile userProfile) {
final YahooOpenIdProfile profile = (YahooOpenIdProfile) userProfile;
assertNotNull(profile);
final String id = "mnsYAxIag.AfFGVrKZckRIVkvVYLEYRM4Q--#02050";
assertEquals("https://me.yahoo.com/a/" + id, profile.getId());
assertEquals(YahooOpenIdProfile.class.getName() + CommonProfile.SEPARATOR + "https://me.yahoo.com/a/" + id, profile.getTypedId());
assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), YahooOpenIdProfile.class));
assertCommonProfile(userProfile, getLogin(), null, null, "Test ScribeUP", null, Gender.UNSPECIFIED, Locale.FRANCE, "https://s.yimg.com/dg/users/1DJGkdA6uAAECQWEo8AceAQ==.medium.png", null, null);
assertEquals(4, profile.getAttributes().size());
}
use of org.pac4j.openid.profile.yahoo.YahooOpenIdProfile in project pac4j by pac4j.
the class YahooAuthenticator method validate.
@Override
public void validate(final OpenIdCredentials credentials, final WebContext context) {
final ParameterList parameterList = credentials.getParameterList();
final DiscoveryInformation discoveryInformation = credentials.getDiscoveryInformation();
logger.debug("parameterList: {}", parameterList);
logger.debug("discoveryInformation: {}", discoveryInformation);
try {
// verify the response
final VerificationResult verification = this.client.getConsumerManager().verify(this.client.computeFinalCallbackUrl(context), parameterList, discoveryInformation);
// examine the verification result and extract the verified identifier
final Identifier verified = verification.getVerifiedId();
if (verified != null) {
final AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
logger.debug("authSuccess: {}", authSuccess);
final YahooOpenIdProfile profile = createProfile(authSuccess);
profile.setId(verified.getIdentifier());
logger.debug("profile: {}", profile);
credentials.setUserProfile(profile);
return;
}
} catch (final OpenIDException e) {
throw new TechnicalException("OpenID exception", e);
}
final String message = "No verifiedId found";
throw new TechnicalException(message);
}
Aggregations