use of org.wso2.carbon.identity.application.authentication.framework.config.model.ApplicationConfig in project carbon-identity-framework by wso2.
the class ConsentMgtPostAuthnHandler method getStandardDialect.
private String getStandardDialect(AuthenticationContext context) {
String clientType = context.getRequestType();
ApplicationConfig appConfig = context.getSequenceConfig().getApplicationConfig();
Map<String, String> claimMappings = appConfig.getClaimMappings();
if (FrameworkConstants.RequestType.CLAIM_TYPE_OIDC.equals(clientType)) {
return HTTP_WSO2_ORG_OIDC_CLAIM;
} else if (FrameworkConstants.RequestType.CLAIM_TYPE_STS.equals(clientType)) {
return HTTP_SCHEMAS_XMLSOAP_ORG_WS_2005_05_IDENTITY;
} else if (FrameworkConstants.RequestType.CLAIM_TYPE_OPENID.equals(clientType)) {
return HTTP_AXSCHEMA_ORG;
} else if (FrameworkConstants.RequestType.CLAIM_TYPE_WSO2.equals(clientType)) {
return ApplicationConstants.LOCAL_IDP_DEFAULT_CLAIM_DIALECT;
} else if (FrameworkConstants.RequestType.CLAIM_TYPE_SCIM.equals(clientType)) {
return URN_SCIM_SCHEMAS_CORE_1_0;
} else if (claimMappings == null || claimMappings.isEmpty()) {
return ApplicationConstants.LOCAL_IDP_DEFAULT_CLAIM_DIALECT;
} else {
boolean isAtLeastOneNotEqual = false;
for (Map.Entry<String, String> entry : claimMappings.entrySet()) {
if (!entry.getKey().equalsIgnoreCase(entry.getValue())) {
isAtLeastOneNotEqual = true;
break;
}
}
if (!isAtLeastOneNotEqual) {
return ApplicationConstants.LOCAL_IDP_DEFAULT_CLAIM_DIALECT;
}
}
return null;
}
use of org.wso2.carbon.identity.application.authentication.framework.config.model.ApplicationConfig in project identity-inbound-auth-oauth by wso2-extensions.
the class PasswordGrantHandler method initializeAuthContext.
/**
* This method will create an AuthenticationContext object which needs to be passed to the publish methods.
*
* @param authenticatedUser User which tries to be authenticated.
* @param serviceProvider Service provider which contains the details of the application.
* @return An AuthenticationContest object with relevant details.
*/
private AuthenticationContext initializeAuthContext(AuthenticatedUser authenticatedUser, ServiceProvider serviceProvider) {
AuthenticationContext authenticationContext = new AuthenticationContext();
String contextId = UUIDGenerator.generateUUID();
authenticationContext.setContextIdentifier(contextId);
authenticationContext.setTenantDomain(authenticatedUser.getTenantDomain());
authenticationContext.setRequestType(OAUTH2);
authenticationContext.setRememberMe(false);
authenticationContext.setForceAuthenticate(true);
authenticationContext.setPassiveAuthenticate(false);
authenticationContext.setProperty(IS_INITIAL_LOGIN, true);
// Setting sequenceConfig with authenticatedUser, serviceProvider.
SequenceConfig sequenceConfig = new SequenceConfig();
sequenceConfig.setAuthenticatedUser(authenticatedUser);
// Setting applicationConfig with serviceProvider.
ApplicationConfig applicationConfig = new ApplicationConfig(serviceProvider);
sequenceConfig.setApplicationConfig(applicationConfig);
sequenceConfig.setAuthenticatedIdPs(FrameworkConstants.LOCAL_IDP_NAME);
authenticationContext.setSequenceConfig(sequenceConfig);
/* Setting the authenticated IDP for currentAuthenticatedIDPs to get
the tenant domain and other parameters when the login is a success. */
AuthenticatedIdPData authenticatedIdPData = new AuthenticatedIdPData();
authenticatedIdPData.setUser(authenticatedUser);
authenticatedIdPData.setIdpName(FrameworkConstants.LOCAL_IDP_NAME);
AuthenticatorConfig authenticatorConfig = new AuthenticatorConfig();
authenticatorConfig.setName(PASSWORD_GRANT_AUTHENTICATOR_NAME);
authenticatedIdPData.addAuthenticator(authenticatorConfig);
authenticationContext.getCurrentAuthenticatedIdPs().put(FrameworkConstants.LOCAL_IDP_NAME, authenticatedIdPData);
// Setting serviceProviderName from applicationConfig.
authenticationContext.setServiceProviderName(sequenceConfig.getApplicationConfig().getApplicationName());
return authenticationContext;
}
Aggregations