use of org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig in project product-is by wso2.
the class DefaultAuthSeqManagementTestCase method updateApplicationData.
private void updateApplicationData(String name) {
try {
ServiceProvider serviceProvider = applicationManagementServiceClient.getApplication(name);
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationType("flow");
AuthenticationStep authStep = new AuthenticationStep();
authStep.setStepOrder(1);
authStep.setAttributeStep(true);
authStep.setSubjectStep(true);
LocalAuthenticatorConfig localAuthenticatorConfig = new LocalAuthenticatorConfig();
localAuthenticatorConfig.setName("BasicAuthenticator");
localAuthenticatorConfig.setDisplayName("basic");
localAuthenticatorConfig.setEnabled(true);
authStep.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localAuthenticatorConfig });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationSteps(new AuthenticationStep[] { authStep });
AuthenticationScriptConfig scriptConfig = new AuthenticationScriptConfig();
scriptConfig.setLanguage("application/javascript");
scriptConfig.setContent("function onLoginRequest(context) {\r\n executeStep(1);\r\n}\r\n");
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationScriptConfig(scriptConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
ServiceProvider updatedServiceProvider = applicationManagementServiceClient.getApplication(applicationName);
Assert.assertEquals(updatedServiceProvider.getLocalAndOutBoundAuthenticationConfig().getAuthenticationSteps()[0].getLocalAuthenticatorConfigs()[0].getDisplayName(), "basic", "Failed update Authentication step");
} catch (Exception e) {
fail("Error while trying to update Service Provider", e);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig in project product-is by wso2.
the class AbstractAdaptiveAuthenticationTestCase method createLocalAndOutboundAuthenticationConfig.
/**
* Create the AdvancedAuthenticator with Multi steps.
* Use any attributes needed if needed to do multiple tests with different advanced authenticators.
*
* @throws Exception
*/
protected LocalAndOutboundAuthenticationConfig createLocalAndOutboundAuthenticationConfig() throws Exception {
LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = new LocalAndOutboundAuthenticationConfig();
localAndOutboundAuthenticationConfig.setAuthenticationType("flow");
AuthenticationStep authenticationStep1 = new AuthenticationStep();
authenticationStep1.setStepOrder(1);
LocalAuthenticatorConfig localConfig = new LocalAuthenticatorConfig();
localConfig.setName(CommonConstants.BASIC_AUTHENTICATOR);
localConfig.setDisplayName("basicauth");
localConfig.setEnabled(true);
authenticationStep1.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localConfig });
authenticationStep1.setSubjectStep(true);
authenticationStep1.setAttributeStep(true);
localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStep1);
return localAndOutboundAuthenticationConfig;
}
use of org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig in project product-is by wso2.
the class RiskBasedLoginTestCase method createLocalAndOutboundAuthenticationConfig.
protected LocalAndOutboundAuthenticationConfig createLocalAndOutboundAuthenticationConfig() throws Exception {
LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = super.createLocalAndOutboundAuthenticationConfig();
AuthenticationStep authenticationStep2 = new AuthenticationStep();
authenticationStep2.setStepOrder(2);
LocalAuthenticatorConfig localConfig = new LocalAuthenticatorConfig();
localConfig.setName("DemoFingerprintAuthenticator");
localConfig.setDisplayName("Demo Fingerprint Authenticator");
localConfig.setEnabled(true);
authenticationStep2.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localConfig });
authenticationStep2.setSubjectStep(false);
authenticationStep2.setAttributeStep(false);
localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStep2);
return localAndOutboundAuthenticationConfig;
}
use of org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig in project product-is by wso2.
the class EmailOTPTestCase method getLocalAndOutBoundAuthenticator.
private LocalAndOutboundAuthenticationConfig getLocalAndOutBoundAuthenticator() throws Exception {
LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = new LocalAndOutboundAuthenticationConfig();
// This will add basic authentication as the first step for authentication.
AuthenticationStep authenticationStepOne = new AuthenticationStep();
authenticationStepOne.setStepOrder(1);
LocalAuthenticatorConfig localConfig = new LocalAuthenticatorConfig();
localConfig.setName(CommonConstants.BASIC_AUTHENTICATOR);
localConfig.setDisplayName("basicauth");
localConfig.setEnabled(true);
authenticationStepOne.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localConfig });
localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStepOne);
// This will add email otp as the second step for authentication.
AuthenticationStep authenticationStepTwo = new AuthenticationStep();
authenticationStepTwo.setStepOrder(2);
authenticationStepTwo.setSubjectStep(false);
authenticationStepTwo.setAttributeStep(false);
authenticationStepTwo.setFederatedIdentityProviders(new IdentityProvider[] { getEmailOTPIdP() });
localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStepTwo);
return localAndOutboundAuthenticationConfig;
}
use of org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig in project identity-api-server by wso2.
the class UpdateAuthenticationSequence method buildAuthenticationStep.
private AuthenticationStep buildAuthenticationStep(AuthenticationStepModel stepModel) {
AuthenticationStep authenticationStep = new AuthenticationStep();
// iteration the options, divide in to federated and local and add the configs
if (CollectionUtils.isEmpty(stepModel.getOptions())) {
throw Utils.buildBadRequestError("Authentication Step options cannot be empty.");
}
List<LocalAuthenticatorConfig> localAuthOptions = new ArrayList<>();
List<IdentityProvider> federatedAuthOptions = new ArrayList<>();
stepModel.getOptions().forEach(option -> {
// TODO : add validations to swagger so that we don't need to check inputs here.
if (FrameworkConstants.LOCAL_IDP_NAME.equals(option.getIdp())) {
LocalAuthenticatorConfig localAuthOption = new LocalAuthenticatorConfig();
localAuthOption.setEnabled(true);
localAuthOption.setName(option.getAuthenticator());
localAuthOptions.add(localAuthOption);
} else {
FederatedAuthenticatorConfig federatedAuthConfig = new FederatedAuthenticatorConfig();
federatedAuthConfig.setEnabled(true);
federatedAuthConfig.setName(option.getAuthenticator());
IdentityProvider federatedIdp = new IdentityProvider();
federatedIdp.setIdentityProviderName(option.getIdp());
federatedIdp.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { federatedAuthConfig });
federatedIdp.setDefaultAuthenticatorConfig(federatedAuthConfig);
federatedAuthOptions.add(federatedIdp);
}
});
authenticationStep.setLocalAuthenticatorConfigs(localAuthOptions.toArray(new LocalAuthenticatorConfig[0]));
authenticationStep.setFederatedIdentityProviders(federatedAuthOptions.toArray(new IdentityProvider[0]));
return authenticationStep;
}
Aggregations