Search in sources :

Example 1 with AuthProtocolMetadata

use of org.wso2.carbon.identity.api.server.application.management.v1.AuthProtocolMetadata in project product-is by wso2.

the class ApplicationMetadataPositiveTest method init.

@BeforeClass(alwaysRun = true)
public void init() throws IOException {
    super.testInit(API_VERSION, swaggerDefinition, tenant);
    // Init getAllEmailTemplateTypes method response
    ObjectMapper jsonWriter = new ObjectMapper(new JsonFactory());
    String expectedResponse = readResource("all-inbound-protocols-response.json");
    allInboundProtocolsResponse = Arrays.asList(jsonWriter.readValue(expectedResponse, AuthProtocolMetadata[].class));
    // Init OIDC Metadata
    expectedResponse = readResource("oidc-metadata.json");
    oidcMetaData = jsonWriter.readValue(expectedResponse, OIDCMetaData.class);
    // Init SAML Metadata
    expectedResponse = readResource("saml-metadata-super-tenant.json");
    samlMetaDataSuperTenant = jsonWriter.readValue(expectedResponse, SAMLMetaData.class);
    expectedResponse = readResource("saml-metadata-tenant.json");
    samlMetaDataTenant = jsonWriter.readValue(expectedResponse, SAMLMetaData.class);
    // Init WS Trust Metadata
    expectedResponse = readResource("ws-trust-metadata-super-tenant.json");
    wsTrustMetaDataSuperTenant = jsonWriter.readValue(expectedResponse, WSTrustMetaData.class);
    expectedResponse = readResource("ws-trust-metadata-tenant.json");
    wsTrustMetaDataTenant = jsonWriter.readValue(expectedResponse, WSTrustMetaData.class);
}
Also used : AuthProtocolMetadata(org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.AuthProtocolMetadata) OIDCMetaData(org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.OIDCMetaData) SAMLMetaData(org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.SAMLMetaData) JsonFactory(com.fasterxml.jackson.core.JsonFactory) WSTrustMetaData(org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.WSTrustMetaData) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with AuthProtocolMetadata

use of org.wso2.carbon.identity.api.server.application.management.v1.AuthProtocolMetadata in project product-is by wso2.

the class ApplicationMetadataPositiveTest method testGetAllInboundProtocols.

@Test
public void testGetAllInboundProtocols() throws IOException {
    Response response = getResponseOfGet(METADATA_API_BASE_PATH + PATH_SEPARATOR + INBOUND_PROTOCOLS_PATH);
    response.then().log().ifValidationFails().assertThat().statusCode(HttpStatus.SC_OK);
    ObjectMapper jsonWriter = new ObjectMapper(new JsonFactory());
    List<AuthProtocolMetadata> responseFound = Arrays.asList(jsonWriter.readValue(response.asString(), AuthProtocolMetadata[].class));
    Assert.assertEquals(responseFound, allInboundProtocolsResponse, "Response of the get all inbound protocols doesn't match.");
}
Also used : Response(io.restassured.response.Response) AuthProtocolMetadata(org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.AuthProtocolMetadata) JsonFactory(com.fasterxml.jackson.core.JsonFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.testng.annotations.Test)

Example 3 with AuthProtocolMetadata

use of org.wso2.carbon.identity.api.server.application.management.v1.AuthProtocolMetadata 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;
}
Also used : AuthProtocolMetadata(org.wso2.carbon.identity.api.server.application.management.v1.AuthProtocolMetadata) ArrayList(java.util.ArrayList) AbstractInboundAuthenticatorConfig(org.wso2.carbon.identity.application.mgt.AbstractInboundAuthenticatorConfig) Map(java.util.Map)

Aggregations

JsonFactory (com.fasterxml.jackson.core.JsonFactory)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 AuthProtocolMetadata (org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.AuthProtocolMetadata)2 Response (io.restassured.response.Response)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 BeforeClass (org.testng.annotations.BeforeClass)1 Test (org.testng.annotations.Test)1 AuthProtocolMetadata (org.wso2.carbon.identity.api.server.application.management.v1.AuthProtocolMetadata)1 AbstractInboundAuthenticatorConfig (org.wso2.carbon.identity.application.mgt.AbstractInboundAuthenticatorConfig)1 OIDCMetaData (org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.OIDCMetaData)1 SAMLMetaData (org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.SAMLMetaData)1 WSTrustMetaData (org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.WSTrustMetaData)1