use of org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig in project carbon-identity-framework by wso2.
the class UIBasedConfigurationLoader method loadRequestPathAuthenticators.
protected void loadRequestPathAuthenticators(SequenceConfig sequenceConfig, ServiceProvider serviceProvider) {
if (serviceProvider.getRequestPathAuthenticatorConfigs() != null && serviceProvider.getRequestPathAuthenticatorConfigs().length > 0) {
List<AuthenticatorConfig> requestPathAuthenticators = new ArrayList<AuthenticatorConfig>();
RequestPathAuthenticatorConfig[] reqAuths = serviceProvider.getRequestPathAuthenticatorConfigs();
// for each request path authenticator
for (RequestPathAuthenticatorConfig reqAuth : reqAuths) {
AuthenticatorConfig authConfig = new AuthenticatorConfig();
String authenticatorName = reqAuth.getName();
authConfig.setName(authenticatorName);
authConfig.setEnabled(true);
// iterate through each system authentication config
for (ApplicationAuthenticator appAuthenticator : FrameworkServiceComponent.getAuthenticators()) {
if (authenticatorName.equalsIgnoreCase(appAuthenticator.getName())) {
authConfig.setApplicationAuthenticator(appAuthenticator);
break;
}
}
requestPathAuthenticators.add(authConfig);
}
sequenceConfig.setReqPathAuthenticators(requestPathAuthenticators);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig in project carbon-identity-framework by wso2.
the class ApplicationManagementServiceImpl method getAllRequestPathAuthenticators.
@Override
public RequestPathAuthenticatorConfig[] getAllRequestPathAuthenticators(String tenantDomain) throws IdentityApplicationManagementException {
try {
startTenantFlow(tenantDomain);
IdentityProviderDAO idpdao = ApplicationMgtSystemConfig.getInstance().getIdentityProviderDAO();
List<RequestPathAuthenticatorConfig> reqPathAuthenticators = idpdao.getAllRequestPathAuthenticators();
if (reqPathAuthenticators != null) {
return reqPathAuthenticators.toArray(new RequestPathAuthenticatorConfig[reqPathAuthenticators.size()]);
}
return new RequestPathAuthenticatorConfig[0];
} catch (Exception e) {
String error = "Error occurred while retrieving all Request Path Authenticators" + ". " + e.getMessage();
throw new IdentityApplicationManagementException(error, e);
} finally {
endTenantFlow();
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig in project carbon-identity-framework by wso2.
the class FrameworkServiceComponent method setAuthenticator.
@Reference(name = "application.authenticator", service = ApplicationAuthenticator.class, cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetAuthenticator")
protected void setAuthenticator(ApplicationAuthenticator authenticator) {
FrameworkServiceDataHolder.getInstance().getAuthenticators().add(authenticator);
Property[] configProperties = null;
List<Property> configurationProperties = authenticator.getConfigurationProperties();
if (configurationProperties == null) {
configurationProperties = new ArrayList<>();
}
if (authenticator instanceof AuthenticationFlowHandler) {
Property handlerProperty = new Property();
handlerProperty.setName(IS_HANDLER);
handlerProperty.setValue(TRUE);
configurationProperties.add(handlerProperty);
}
if (!configurationProperties.isEmpty()) {
configProperties = configurationProperties.toArray(new Property[0]);
}
if ((authenticator instanceof LocalApplicationAuthenticator) || (authenticator instanceof AuthenticationFlowHandler)) {
LocalAuthenticatorConfig localAuthenticatorConfig = new LocalAuthenticatorConfig();
localAuthenticatorConfig.setName(authenticator.getName());
localAuthenticatorConfig.setProperties(configProperties);
localAuthenticatorConfig.setDisplayName(authenticator.getFriendlyName());
localAuthenticatorConfig.setTags(authenticator.getTags());
AuthenticatorConfig fileBasedConfig = getAuthenticatorConfig(authenticator.getName());
localAuthenticatorConfig.setEnabled(fileBasedConfig.isEnabled());
ApplicationAuthenticatorService.getInstance().addLocalAuthenticator(localAuthenticatorConfig);
} else if (authenticator instanceof FederatedApplicationAuthenticator) {
FederatedAuthenticatorConfig federatedAuthenticatorConfig = new FederatedAuthenticatorConfig();
federatedAuthenticatorConfig.setName(authenticator.getName());
federatedAuthenticatorConfig.setProperties(configProperties);
federatedAuthenticatorConfig.setDisplayName(authenticator.getFriendlyName());
federatedAuthenticatorConfig.setTags(authenticator.getTags());
ApplicationAuthenticatorService.getInstance().addFederatedAuthenticator(federatedAuthenticatorConfig);
} else if (authenticator instanceof RequestPathApplicationAuthenticator) {
RequestPathAuthenticatorConfig reqPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
reqPathAuthenticatorConfig.setName(authenticator.getName());
reqPathAuthenticatorConfig.setProperties(configProperties);
reqPathAuthenticatorConfig.setDisplayName(authenticator.getFriendlyName());
reqPathAuthenticatorConfig.setTags(authenticator.getTags());
AuthenticatorConfig fileBasedConfig = getAuthenticatorConfig(authenticator.getName());
reqPathAuthenticatorConfig.setEnabled(fileBasedConfig.isEnabled());
ApplicationAuthenticatorService.getInstance().addRequestPathAuthenticator(reqPathAuthenticatorConfig);
}
if (log.isDebugEnabled()) {
log.debug("Added application authenticator : " + authenticator.getName());
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig in project carbon-identity-framework by wso2.
the class ApplicationManagementServiceImplTest method addApplicationConfigurations.
private void addApplicationConfigurations(ServiceProvider serviceProvider) {
serviceProvider.setDescription("Created for testing");
serviceProvider.setSaasApp(TRUE);
// Inbound Authentication Configurations.
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
InboundAuthenticationRequestConfig authRequestConfig = new InboundAuthenticationRequestConfig();
authRequestConfig.setInboundAuthKey("auth key");
authRequestConfig.setInboundAuthType("oauth2");
InboundAuthenticationRequestConfig[] authRequests = new InboundAuthenticationRequestConfig[] { authRequestConfig };
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(authRequests);
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
// Inbound Provisioning Configurations.
InboundProvisioningConfig provisioningConfig = new InboundProvisioningConfig();
provisioningConfig.setProvisioningUserStore("UserStore");
serviceProvider.setInboundProvisioningConfig(provisioningConfig);
// OutBound Provisioning Configurations.
IdentityProvider provisioningIdP = new IdentityProvider();
provisioningIdP.setIdentityProviderName("Provisioning IdP");
OutboundProvisioningConfig outboundProvisioningConfig = new OutboundProvisioningConfig();
outboundProvisioningConfig.setProvisioningIdentityProviders(new IdentityProvider[] { provisioningIdP });
ProvisioningConnectorConfig provisioningConnectorConfig = new ProvisioningConnectorConfig();
provisioningConnectorConfig.setName("Provisioning connector");
provisioningIdP.setDefaultProvisioningConnectorConfig(provisioningConnectorConfig);
serviceProvider.setOutboundProvisioningConfig(outboundProvisioningConfig);
// Local And OutBound Authentication Configuration.
LocalAndOutboundAuthenticationConfig authenticationConfig = new LocalAndOutboundAuthenticationConfig();
AuthenticationStep authenticationStep = new AuthenticationStep();
IdentityProvider identityProvider = new IdentityProvider();
identityProvider.setIdentityProviderName(IDP_NAME_1);
FederatedAuthenticatorConfig federatedAuthenticatorConfig = new FederatedAuthenticatorConfig();
federatedAuthenticatorConfig.setName("Federated authenticator");
identityProvider.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { federatedAuthenticatorConfig });
authenticationStep.setFederatedIdentityProviders(new IdentityProvider[] { identityProvider });
LocalAuthenticatorConfig localAuthenticatorConfig = new LocalAuthenticatorConfig();
localAuthenticatorConfig.setName("Local authenticator");
authenticationStep.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localAuthenticatorConfig });
authenticationConfig.setAuthenticationSteps(new AuthenticationStep[] { authenticationStep });
serviceProvider.setLocalAndOutBoundAuthenticationConfig(authenticationConfig);
// Request Path Authenticator Configuration.
RequestPathAuthenticatorConfig requestPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
requestPathAuthenticatorConfig.setName("Request path authenticator");
serviceProvider.setRequestPathAuthenticatorConfigs(new RequestPathAuthenticatorConfig[] { requestPathAuthenticatorConfig });
// Claim Configurations.
ClaimConfig claimConfig = new ClaimConfig();
claimConfig.setRoleClaimURI("Role claim uri");
claimConfig.setSpClaimDialects(new String[] { "SP claim dialect" });
ClaimMapping claimMapping = new ClaimMapping();
Claim localClaim = new Claim();
localClaim.setClaimUri("Local claim uri");
Claim remoteClaim = new Claim();
remoteClaim.setClaimUri("Remote claim uri");
claimMapping.setLocalClaim(localClaim);
claimMapping.setRemoteClaim(remoteClaim);
claimConfig.setClaimMappings(new ClaimMapping[] { claimMapping });
serviceProvider.setClaimConfig(claimConfig);
// Permission Role Configurations.
PermissionsAndRoleConfig permissionsAndRoleConfig = new PermissionsAndRoleConfig();
RoleMapping roleMapping = new RoleMapping();
LocalRole localRole = new LocalRole("Local role");
roleMapping.setLocalRole(localRole);
roleMapping.setRemoteRole("Remote role");
RoleMapping[] roleMappings = new RoleMapping[] { roleMapping };
permissionsAndRoleConfig.setRoleMappings(roleMappings);
}
use of org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig in project carbon-identity-framework by wso2.
the class ApplicationManagementServiceImplTest method testGetAllRequestPathAuthenticators.
@Test
public void testGetAllRequestPathAuthenticators() throws IdentityApplicationManagementException {
ApplicationAuthenticatorService appAuthenticatorService = ApplicationAuthenticatorService.getInstance();
RequestPathAuthenticatorConfig requestPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
appAuthenticatorService.addRequestPathAuthenticator(requestPathAuthenticatorConfig);
RequestPathAuthenticatorConfig[] requestPathAuthenticatorConfigs = applicationManagementService.getAllRequestPathAuthenticators(SUPER_TENANT_DOMAIN_NAME);
Assert.assertEquals(requestPathAuthenticatorConfigs[0], requestPathAuthenticatorConfig);
}
Aggregations