use of org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.SAML2 in project product-is by wso2.
the class OIDCIdentityFederationTestCase 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(PRIMARY_IS_SP_INBOUND_AUTH_TYPE_SAMLSSO);
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 OAuth2ServiceSAML2BearerGrantTestCase method testSAML2BearerValidSAMLAssertion.
@Test
public void testSAML2BearerValidSAMLAssertion() {
try {
// Get a SAML response.
String samlResponse = getSAMLResponse();
// Extract the assertion from SAML response.
String samlAssersion = getSAMLAssersion(samlResponse);
// Send the extracted SAML assertion to token endpoint in SAML2 bearer grant.
HttpResponse httpResponse = sendSAMLAssertion(samlAssersion);
// Extract the response value from http response.
String responseValue = IOUtils.toString(httpResponse.getEntity().getContent());
// If we have an access token in the response test is successful.
Assert.assertTrue(responseValue.contains("access_token"));
} catch (Exception e) {
Assert.fail("SAML Bearer Grant test failed with an exception.", e);
}
}
use of org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.SAML2 in project identity-api-server by wso2.
the class ServerApplicationMetadataService method getInboundProtocols.
/**
* Return a list of all available inbound protocols. If the customOnly parameter set to True, will return only the
* custom protocols.
*
* @param customOnly Set to True to get only custom protocols. Default value: False.
* @return The list of inbound protocols.
*/
public List<AuthProtocolMetadata> getInboundProtocols(Boolean customOnly) {
List<AuthProtocolMetadata> authProtocolMetadataList = new ArrayList<>();
// Add custom inbound protocols
Map<String, AbstractInboundAuthenticatorConfig> allCustomAuthenticators = ApplicationManagementServiceHolder.getApplicationManagementService().getAllInboundAuthenticatorConfig();
for (Map.Entry<String, AbstractInboundAuthenticatorConfig> entry : allCustomAuthenticators.entrySet()) {
AuthProtocolMetadata protocol = new AuthProtocolMetadata().name(entry.getValue().getName()).displayName(entry.getValue().getFriendlyName());
authProtocolMetadataList.add(protocol);
}
if (customOnly == null || !customOnly) {
// Add default inbound protocols. WS-Federation (Passive) is not added because it doesn't have metadata,
authProtocolMetadataList.add(new AuthProtocolMetadata().name("saml").displayName("SAML2 Web SSO Configuration"));
authProtocolMetadataList.add(new AuthProtocolMetadata().name("oidc").displayName("OAuth/OpenID Connect Configuration"));
authProtocolMetadataList.add(new AuthProtocolMetadata().name("ws-trust").displayName("WS-Trust Security Token Service Configuration"));
}
return authProtocolMetadataList;
}
Aggregations