use of org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.SAML2 in project product-is by wso2.
the class OIDCFederatedIdpInitLogoutTest method createServiceProviderInSecondaryIS.
private void createServiceProviderInSecondaryIS() throws Exception {
super.addServiceProvider(PORT_OFFSET_1, FEDERATED_IS_SP_NAME);
ServiceProvider serviceProvider = getServiceProvider(PORT_OFFSET_1, FEDERATED_IS_SP_NAME);
Assert.assertNotNull(serviceProvider, "Failed to create service provider 'travelocity' in primary IS");
updateServiceProviderWithSAMLConfigs(PORT_OFFSET_1, FEDERATED_IS_SAML_ISSUER_NAME, FEDERATED_IS_SAML_ACS_URL, serviceProvider);
updateServiceProvider(PORT_OFFSET_1, serviceProvider);
serviceProvider = getServiceProvider(PORT_OFFSET_1, FEDERATED_IS_SP_NAME);
InboundAuthenticationRequestConfig[] configs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
boolean success = false;
if (configs != null) {
for (InboundAuthenticationRequestConfig config : configs) {
if (FEDERATED_IS_SP_INBOUND_AUTH_TYPE_SAMLSSO.equals(config.getInboundAuthType())) {
success = true;
break;
}
}
}
Assert.assertTrue(success, "Failed to update service provider with inbound SAML2 configs in primary IS");
}
use of org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.SAML2 in project product-is by wso2.
the class OIDCIdentityFederationTestCase method createServiceProviderInPrimaryIS.
private void createServiceProviderInPrimaryIS() throws Exception {
super.addServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SP_NAME);
ServiceProvider serviceProvider = getServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SP_NAME);
Assert.assertNotNull(serviceProvider, "Failed to create service provider 'travelocity' in primary IS");
updateServiceProviderWithSAMLConfigs(PORT_OFFSET_0, PRIMARY_IS_SAML_ISSUER_NAME, PRIMARY_IS_SAML_ACS_URL, serviceProvider);
AuthenticationStep authStep = new AuthenticationStep();
org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider idP = new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider();
idP.setIdentityProviderName(PRIMARY_IS_IDP_NAME);
org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig oidcAuthnConfig = new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig();
oidcAuthnConfig.setName(PRIMARY_IS_IDP_AUTHENTICATOR_NAME_OIDC);
oidcAuthnConfig.setDisplayName("openidconnect");
idP.setFederatedAuthenticatorConfigs(new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig[] { oidcAuthnConfig });
authStep.setFederatedIdentityProviders(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[] { idP });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationSteps(new AuthenticationStep[] { authStep });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationType(PRIMARY_IS_SP_AUTHENTICATION_TYPE);
updateServiceProvider(PORT_OFFSET_0, serviceProvider);
serviceProvider = getServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SP_NAME);
InboundAuthenticationRequestConfig[] configs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
boolean success = false;
if (configs != null) {
for (InboundAuthenticationRequestConfig config : configs) {
if (PRIMARY_IS_SP_INBOUND_AUTH_TYPE_SAMLSSO.equals(config.getInboundAuthType())) {
success = true;
break;
}
}
}
Assert.assertTrue(success, "Failed to update service provider with inbound SAML2 configs in primary IS");
Assert.assertTrue(PRIMARY_IS_SP_AUTHENTICATION_TYPE.equals(serviceProvider.getLocalAndOutBoundAuthenticationConfig().getAuthenticationType()), "Failed to update local and out bound configs in primary IS");
}
use of org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.SAML2 in project product-is by wso2.
the class SAMLIdentityFederationTestCase method updateServiceProviderWithSAMLConfigs.
private void updateServiceProviderWithSAMLConfigs(int portOffset, String issuerName, String acsUrl, ServiceProvider serviceProvider) throws Exception {
String attributeConsumingServiceIndex = super.createSAML2WebSSOConfiguration(portOffset, getSAMLSSOServiceProviderDTO(issuerName, acsUrl));
Assert.assertNotNull(attributeConsumingServiceIndex, "Failed to create SAML2 Web SSO configuration for issuer '" + issuerName + "'");
InboundAuthenticationRequestConfig samlAuthenticationRequestConfig = new InboundAuthenticationRequestConfig();
samlAuthenticationRequestConfig.setInboundAuthKey(issuerName);
samlAuthenticationRequestConfig.setInboundAuthType(INBOUND_AUTH_TYPE);
org.wso2.carbon.identity.application.common.model.xsd.Property property = new org.wso2.carbon.identity.application.common.model.xsd.Property();
property.setName("attrConsumServiceIndex");
property.setValue(attributeConsumingServiceIndex);
samlAuthenticationRequestConfig.setProperties(new org.wso2.carbon.identity.application.common.model.xsd.Property[] { property });
serviceProvider.getInboundAuthenticationConfig().setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { samlAuthenticationRequestConfig });
}
use of org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.SAML2 in project product-is by wso2.
the class SAMLFederationWithFileBasedSPAndIDPTestCase method testCreateServiceProviderInSecondaryIS.
@Test(groups = "wso2.is", description = "Check create service provider in secondary IS")
public void testCreateServiceProviderInSecondaryIS() throws Exception {
super.addServiceProvider(PORT_OFFSET_1, SECONDARY_IS_SERVICE_PROVIDER_NAME);
ServiceProvider serviceProvider = getServiceProvider(PORT_OFFSET_1, SECONDARY_IS_SERVICE_PROVIDER_NAME);
Assert.assertNotNull(serviceProvider, "Failed to create service provider 'secondarySP' in secondary IS");
// Set SAML configurations
updateServiceProviderWithSAMLConfigs(PORT_OFFSET_1, SECONDARY_IS_SAML_ISSUER_NAME, String.format(COMMON_AUTH_URL, DEFAULT_PORT + PORT_OFFSET_0), serviceProvider);
// Set claim configurations
serviceProvider.getClaimConfig().setLocalClaimDialect(false);
serviceProvider.getClaimConfig().setClaimMappings(getClaimMappingsForSPInSecondaryIS());
updateServiceProvider(PORT_OFFSET_1, serviceProvider);
serviceProvider = getServiceProvider(PORT_OFFSET_1, SECONDARY_IS_SERVICE_PROVIDER_NAME);
InboundAuthenticationRequestConfig[] configs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
boolean success = false;
if (configs != null) {
for (InboundAuthenticationRequestConfig config : configs) {
if (SECONDARY_IS_SAML_ISSUER_NAME.equals(config.getInboundAuthKey()) && INBOUND_AUTH_TYPE.equals(config.getInboundAuthType())) {
success = true;
break;
}
}
}
Assert.assertTrue(success, "Failed to update service provider with inbound SAML2 configs in secondary IS");
}
use of org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.SAML2 in project product-is by wso2.
the class TestPassiveSTS method testPassiveSAML2AssertionWithoutWReply.
@Test(alwaysRun = true, description = "Test PassiveSTS SAML2 Assertion with WReply URL in passive-sts request", dependsOnMethods = { "testPassiveSAML2Assertion" })
public void testPassiveSAML2AssertionWithoutWReply() throws Exception {
String passiveParams = "?wa=wsignin1.0&wtrealm=PassiveSTSSampleApp";
String wreqParam = "&wreq=%3Cwst%3ARequestSecurityToken+xmlns%3Awst%3D%22http%3A%2F%2Fdocs.oasis-open.org" + "%2Fws-sx%2Fws-trust%2F200512%22%3E%3Cwst%3ATokenType%3Ehttp%3A%2F%2Fdocs.oasis-open.org" + "%2Fwss%2Foasis-wss-saml-token-profile-1.1%23SAMLV2.0%3C%2Fwst%3ATokenType%3E%3C%2Fwst" + "%3ARequestSecurityToken%3E";
passiveParams = appendTenantDomainQueryParam(passiveParams);
HttpGet request = new HttpGet(this.passiveStsURL + passiveParams + wreqParam);
HttpResponse response = client.execute(request);
Assert.assertNotNull(response, "PassiveSTSSampleApp invoke response is null for tenant domain: " + tenantDomain);
int responseCode = response.getStatusLine().getStatusCode();
Assert.assertEquals(responseCode, 200, "Invalid Response for tenant domain: " + tenantDomain);
HttpEntity entity = response.getEntity();
String responseString = EntityUtils.toString(entity, "UTF-8");
Assert.assertTrue(responseString.contains("urn:oasis:names:tc:SAML:2.0:assertion"), "No SAML2 Assertion found for the SAML2 request without WReply in passive-sts request for " + "tenant domain: " + tenantDomain);
}
Aggregations