Search in sources :

Example 1 with DefaultAuthSeqMgtService

use of org.wso2.carbon.identity.application.mgt.defaultsequence.DefaultAuthSeqMgtService in project carbon-identity-framework by wso2.

the class ApplicationManagementServiceImpl method setDefaultAuthenticationSeq.

private void setDefaultAuthenticationSeq(String sequenceName, String tenantDomain, ServiceProvider serviceProvider) throws IdentityApplicationManagementException {
    // if "Authentication Type" is "Default", get the tenant wise default authentication sequence if
    // available, otherwise the authentication sequence and adaptive script configuration in default SP
    DefaultAuthSeqMgtService seqMgtService = DefaultAuthSeqMgtServiceImpl.getInstance();
    DefaultAuthenticationSequence sequence;
    try {
        sequence = seqMgtService.getDefaultAuthenticationSeq(sequenceName, tenantDomain);
    } catch (DefaultAuthSeqMgtException e) {
        throw new IdentityApplicationManagementException("Error when retrieving default " + "authentication sequence in tenant: " + tenantDomain, e);
    }
    if (sequence != null && sequence.getContent() != null) {
        serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationSteps(sequence.getContent().getAuthenticationSteps());
        serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationScriptConfig(sequence.getContent().getAuthenticationScriptConfig());
    } else {
        ServiceProvider defaultSP = ApplicationManagementServiceComponent.getFileBasedSPs().get(IdentityApplicationConstants.DEFAULT_SP_CONFIG);
        serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationSteps(defaultSP.getLocalAndOutBoundAuthenticationConfig().getAuthenticationSteps());
        serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationScriptConfig(defaultSP.getLocalAndOutBoundAuthenticationConfig().getAuthenticationScriptConfig());
    }
}
Also used : DefaultAuthenticationSequence(org.wso2.carbon.identity.application.common.model.DefaultAuthenticationSequence) DefaultAuthSeqMgtService(org.wso2.carbon.identity.application.mgt.defaultsequence.DefaultAuthSeqMgtService) DefaultAuthSeqMgtException(org.wso2.carbon.identity.application.mgt.defaultsequence.DefaultAuthSeqMgtException) IdentityApplicationManagementException(org.wso2.carbon.identity.application.common.IdentityApplicationManagementException) ServiceProvider(org.wso2.carbon.identity.application.common.model.ServiceProvider)

Aggregations

IdentityApplicationManagementException (org.wso2.carbon.identity.application.common.IdentityApplicationManagementException)1 DefaultAuthenticationSequence (org.wso2.carbon.identity.application.common.model.DefaultAuthenticationSequence)1 ServiceProvider (org.wso2.carbon.identity.application.common.model.ServiceProvider)1 DefaultAuthSeqMgtException (org.wso2.carbon.identity.application.mgt.defaultsequence.DefaultAuthSeqMgtException)1 DefaultAuthSeqMgtService (org.wso2.carbon.identity.application.mgt.defaultsequence.DefaultAuthSeqMgtService)1