use of org.wso2.carbon.identity.application.authentication.framework.handler.claims.ClaimFilter in project identity-inbound-auth-oauth by wso2-extensions.
the class OpenIDConnectClaimFilterImplTest method testGetClaimsFilteredByUserConsentWithException.
@Test
public void testGetClaimsFilteredByUserConsentWithException() throws Exception {
claims = getClaims();
AuthenticatedUser user = getDefaultAuthenticatedLocalUser();
when(ssoConsentService.isSSOConsentManagementEnabled(any())).thenReturn(false);
Mockito.doThrow(new IdentityApplicationManagementException("")).when(applicationMgtService).getServiceProviderByClientId("dummy", IdentityApplicationConstants.OAuth2.NAME, SP_TENANT_DOMAIN);
Map<String, Object> claimFilter = openIDConnectClaimFilter.getClaimsFilteredByUserConsent(claims, user, "dummy", SP_TENANT_DOMAIN);
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI")).getName(), "email");
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI")).getDescription(), "emailDescription");
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI2")).getName(), "address");
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI2")).getDescription(), "addressDescription");
}
use of org.wso2.carbon.identity.application.authentication.framework.handler.claims.ClaimFilter in project identity-inbound-auth-oauth by wso2-extensions.
the class OpenIDConnectClaimFilterImplTest method testGetClaimsFilteredByUserConsent.
@Test
public void testGetClaimsFilteredByUserConsent() throws Exception {
claims = getClaims();
AuthenticatedUser user = getDefaultAuthenticatedLocalUser();
when(ssoConsentService.isSSOConsentManagementEnabled(any())).thenReturn(true);
Map<String, Object> claimFilter = openIDConnectClaimFilter.getClaimsFilteredByUserConsent(claims, user, CLIENT_ID, SP_TENANT_DOMAIN);
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI")).getName(), "email");
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI")).getDescription(), "emailDescription");
Assert.assertNull(claimFilter.get("testUserClaimURI2"));
}
use of org.wso2.carbon.identity.application.authentication.framework.handler.claims.ClaimFilter in project identity-inbound-auth-oauth by wso2-extensions.
the class OpenIDConnectClaimFilterImplTest method testGetClaimsFilteredByUserConsentWithManagementServiceDisabled.
@Test
public void testGetClaimsFilteredByUserConsentWithManagementServiceDisabled() throws Exception {
claims = getClaims();
AuthenticatedUser user = getDefaultAuthenticatedLocalUser();
when(ssoConsentService.isSSOConsentManagementEnabled(any())).thenReturn(false);
Map<String, Object> claimFilter = openIDConnectClaimFilter.getClaimsFilteredByUserConsent(claims, user, CLIENT_ID, SP_TENANT_DOMAIN);
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI")).getName(), "email");
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI")).getDescription(), "emailDescription");
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI2")).getName(), "address");
Assert.assertEquals(((ScopeDTO) claimFilter.get("testUserClaimURI2")).getDescription(), "addressDescription");
}
Aggregations