use of org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig in project carbon-identity-framework by wso2.
the class DefaultAuthSeqMgtServiceImpl method unmarshalDefaultAuthSeq.
/**
* Convert xml file of default authentication sequence to object.
*
* @param defaultAuthSeq xml string of the default authentication sequence
* @param tenantDomain tenant domain name
* @return LocalAndOutboundAuthenticationConfig instance
* @throws DefaultAuthSeqMgtException Auth Sequence Management Client Exception
*/
private LocalAndOutboundAuthenticationConfig unmarshalDefaultAuthSeq(String defaultAuthSeq, String tenantDomain) throws DefaultAuthSeqMgtException {
if (StringUtils.isEmpty(defaultAuthSeq)) {
throw new DefaultAuthSeqMgtException(new String[] { "Empty default authentication sequence " + "configuration is provided" });
}
try {
JAXBContext jaxbContext = JAXBContext.newInstance(LocalAndOutboundAuthenticationConfig.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
JAXBElement<LocalAndOutboundAuthenticationConfig> root = unmarshaller.unmarshal(new StreamSource(new ByteArrayInputStream(defaultAuthSeq.getBytes(StandardCharsets.UTF_8))), LocalAndOutboundAuthenticationConfig.class);
if (root.getName().getLocalPart().equalsIgnoreCase(LocalAndOutboundAuthenticationConfig.class.getSimpleName())) {
return root.getValue();
}
throw new DefaultAuthSeqMgtException(new String[] { "Syntax error in the provided default " + "authentication sequence" });
} catch (JAXBException e) {
String msg = "Error in reading default authentication sequence configuration in tenant: " + tenantDomain;
log.error(msg, e);
throw new DefaultAuthSeqMgtException(new String[] { msg });
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig in project product-is by wso2.
the class SAMLLocalAndOutboundAuthenticatorsTestCase method createAdvanceAuthenticatorWithMultiOptions.
/**
* Create the AdvancedAuthenticator with Multi options.
* Use any attributes needed if needed to do multiple tests with different advanced authenticators.
* @throws Exception
*/
private void createAdvanceAuthenticatorWithMultiOptions() throws Exception {
LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = new LocalAndOutboundAuthenticationConfig();
AuthenticationStep authenticationStep = new AuthenticationStep();
authenticationStep.setStepOrder(1);
LocalAuthenticatorConfig localConfig = new LocalAuthenticatorConfig();
localConfig.setName(CommonConstants.BASIC_AUTHENTICATOR);
localConfig.setDisplayName("basicauth");
localConfig.setEnabled(true);
authenticationStep.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localConfig });
authenticationStep.setFederatedIdentityProviders(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[] { getFederatedGoogleIDP() });
authenticationStep.setSubjectStep(true);
authenticationStep.setAttributeStep(true);
localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStep);
config.getAuthenticator().setLocalAndOutboundAuthenticationConfig(localAndOutboundAuthenticationConfig);
}
use of org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig in project product-is by wso2.
the class ConditionalAuthenticationTestCase method updateAuthScript.
/**
* Update service provider authentication script config.
*
* @param filename File Name of the authentication script.
* @throws Exception
*/
private void updateAuthScript(String filename) throws Exception {
LocalAndOutboundAuthenticationConfig outboundAuthConfig = createLocalAndOutboundAuthenticationConfig();
outboundAuthConfig.setEnableAuthorization(true);
String script = getConditionalAuthScript(filename);
AuthenticationScriptConfig config = new AuthenticationScriptConfig();
config.setContent(script);
config.setEnabled(true);
outboundAuthConfig.setAuthenticationScriptConfig(config);
serviceProvider.setLocalAndOutBoundAuthenticationConfig(outboundAuthConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
}
use of org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig in project product-is by wso2.
the class ConditionalAuthenticationTestCase method createLocalAndOutboundAuthenticationConfig.
protected LocalAndOutboundAuthenticationConfig createLocalAndOutboundAuthenticationConfig() throws Exception {
LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = super.createLocalAndOutboundAuthenticationConfig();
AuthenticationStep authenticationStep2 = new AuthenticationStep();
authenticationStep2.setStepOrder(2);
authenticationStep2.setSubjectStep(false);
authenticationStep2.setAttributeStep(false);
authenticationStep2.setFederatedIdentityProviders(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[] { getFederatedSAMLSSOIDP() });
localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStep2);
return localAndOutboundAuthenticationConfig;
}
use of org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig in project product-is by wso2.
the class AbstractApplicationAuthzTestCase method createApplication.
protected void createApplication(String applicationName) throws Exception {
ServiceProvider serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(applicationName);
serviceProvider.setDescription("This is a test Service Provider for AZ test");
applicationManagementServiceClient.createApplication(serviceProvider);
serviceProvider = applicationManagementServiceClient.getApplication(applicationName);
InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthType(INBOUND_AUTH_TYPE);
requestConfig.setInboundAuthKey(applicationName);
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
LocalAndOutboundAuthenticationConfig outboundAuthConfig = new LocalAndOutboundAuthenticationConfig();
outboundAuthConfig.setEnableAuthorization(true);
serviceProvider.setLocalAndOutBoundAuthenticationConfig(outboundAuthConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
}
Aggregations