use of org.pac4j.oidc.profile.OidcProfile in project pac4j by pac4j.
the class RunCasOidcWrapper method verifyProfile.
@Override
protected void verifyProfile(final CommonProfile userProfile) {
final OidcProfile profile = (OidcProfile) userProfile;
assertEquals(getLogin(), profile.getId());
assertNotNull(profile.getIdToken());
assertEquals("http://localhost:8080/cas/oidc", profile.getIssuer());
assertEquals(CLIENT_ID, profile.getAttribute("preferred_username"));
assertNotNull(profile.getAccessToken());
assertEquals(CLIENT_ID, profile.getAudience().get(0));
assertNotNull(profile.getNotBefore());
assertNotNull(profile.getAuthTime());
assertNotNull(profile.getAttribute("state"));
assertNotNull(profile.getExpirationDate());
assertNotNull(profile.getIssuedAt());
assertNotNull(profile.getAttribute("jti"));
assertEquals(13, profile.getAttributes().size());
}
use of org.pac4j.oidc.profile.OidcProfile in project pac4j by pac4j.
the class RunIdentityServer4 method verifyProfile.
@Override
protected void verifyProfile(final CommonProfile userProfile) {
final OidcProfile profile = (OidcProfile) userProfile;
assertEquals("818727", profile.getId());
assertNotNull(profile.getIdToken());
assertEquals("test", profile.getAudience().get(0));
assertNotNull(profile.getNotBefore());
assertEquals("idsvr", profile.getAttribute("idp"));
assertNotNull(profile.getAuthTime());
assertEquals("http://localhost:1941", profile.getIssuer());
assertEquals("Alice Smith", profile.getDisplayName());
assertNotNull(profile.getExpirationDate());
assertNotNull(profile.getIssuedAt());
assertNotNull(profile.getAttribute("sid"));
if (flow == Flow.IMPLICIT_FLOW || flow == Flow.IMPLICIT_FLOW_CLIENT_SIDE) {
assertNull(profile.getAccessToken());
assertEquals(12, profile.getAttributes().size());
} else if (flow == Flow.AUTHORIZATION_CODE) {
assertNotNull(profile.getAccessToken());
assertEquals(12, profile.getAttributes().size());
} else if (flow == Flow.HYBRID_FLOW) {
assertNotNull(profile.getAccessToken());
assertEquals(13, profile.getAttributes().size());
}
}
use of org.pac4j.oidc.profile.OidcProfile in project pac4j by pac4j.
the class RunKeycloakOidcClient method verifyProfile.
@Override
protected void verifyProfile(final CommonProfile userProfile) {
final OidcProfile profile = (OidcProfile) userProfile;
assertEquals(IDENTIFIER, profile.getId());
assertNotNull(profile.getIdToken());
assertNotNull(profile.getNotBefore());
assertEquals(ISSUER, profile.getIssuer());
assertEquals(NAME_VALUE, profile.getDisplayName());
assertNotNull(profile.getExpirationDate());
assertNotNull(profile.getIssuedAt());
assertNotNull(profile.getAccessToken());
assertEquals(GIVEN_NAME, profile.getAttribute("given_name"));
assertEquals(FAMILY_NAME, profile.getAttribute("family_name"));
assertEquals(PREFERRED_USERNAME, profile.getAttribute("preferred_username"));
assertEquals(EMAIL_VALUE, profile.getAttribute("email"));
}
use of org.pac4j.oidc.profile.OidcProfile in project pac4j by pac4j.
the class RunOkta method verifyProfile.
@Override
protected void verifyProfile(final CommonProfile userProfile) {
final OidcProfile profile = (OidcProfile) userProfile;
assertEquals("00u5h0czw1aIjTQtM0h7", profile.getId());
assertEquals(OidcProfile.class.getName() + CommonProfile.SEPARATOR + "00u5h0czw1aIjTQtM0h7", profile.getTypedId());
assertNotNull(profile.getAccessToken());
assertNotNull(profile.getIdToken());
assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), OidcProfile.class));
assertNotNull(profile.getIdTokenString());
assertCommonProfile(profile, getLogin(), "Test", "pac4j", "Test pac4j", "testpac4j@gmail.com", Gender.UNSPECIFIED, new Locale("en", "US"), null, null, "America/Los_Angeles");
assertTrue((Boolean) profile.getAttribute("email_verified"));
assertNotNull(profile.getAttribute("at_hash"));
assertEquals("1", profile.getAttribute("ver").toString());
assertNotNull(profile.getAmr());
assertEquals("https://dev-425954.oktapreview.com", profile.getIssuer());
assertEquals("ZuxDX1Gw2Kvx4gFyDNWC", profile.getAudience().get(0));
assertEquals("00o5gxpohzF1JWEXZ0h7", profile.getAttribute("idp"));
assertNotNull(profile.getAuthTime());
assertNotNull(profile.getExpirationDate());
assertNotNull(profile.getIssuedAt());
assertNotNull(profile.getAttribute("jti"));
assertEquals(22, profile.getAttributes().size());
}
use of org.pac4j.oidc.profile.OidcProfile in project ddf by codice.
the class OidcLogoutActionProviderTest method setup.
@Before
public void setup() {
oidcLogoutActionBuilder = mock(OidcLogoutActionBuilder.class);
OidcHandlerConfiguration handlerConfiguration = mock(OidcHandlerConfiguration.class);
when(handlerConfiguration.getOidcLogoutActionBuilder()).thenReturn(oidcLogoutActionBuilder);
oidcLogoutActionProvider = new OidcLogoutActionProvider(handlerConfiguration);
oidcLogoutActionProvider.setSubjectOperations(new SubjectUtils());
request = mock(HttpServletRequest.class);
response = mock(HttpServletResponse.class);
subject = mock(Subject.class);
HttpSession session = mock(HttpSession.class);
PrincipalHolder principalHolderMock = mock(PrincipalHolder.class);
SimplePrincipalCollection principalCollection = new SimplePrincipalCollection();
SecurityAssertion securityAssertion = mock(SecurityAssertion.class);
OidcProfile profile = mock(OidcProfile.class);
when(securityAssertion.getToken()).thenReturn(profile);
when(securityAssertion.getTokenType()).thenReturn(SecurityAssertionJwt.JWT_TOKEN_TYPE);
when(subject.getPrincipals()).thenReturn(principalCollection);
when(principalHolderMock.getPrincipals()).thenReturn(principalCollection);
principalCollection.add(securityAssertion, "oidc");
when(session.getAttribute(SecurityConstants.SECURITY_TOKEN_KEY)).thenReturn(principalHolderMock);
when(request.getSession(false)).thenReturn(session);
}
Aggregations