Search in sources :

Example 51 with ApplicationDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project product-microgateway by wso2.

the class ValidationTestCase method start.

@BeforeClass
public void start() throws Exception {
    ApplicationDTO application = new ApplicationDTO();
    application.setName("jwtApp");
    application.setTier("Unlimited");
    application.setId((int) (Math.random() * 1000));
    super.init("validation-project", new String[] { "validation/validation_api.yaml" }, null, "confs/validation.conf");
    apikey = getAPIKey();
}
Also used : ApplicationDTO(org.wso2.micro.gateway.tests.common.model.ApplicationDTO) BeforeClass(org.testng.annotations.BeforeClass)

Example 52 with ApplicationDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project identity-inbound-auth-oauth by wso2-extensions.

the class RegisterApiServiceImpl method registerApplication.

@Override
public Response registerApplication(RegistrationRequestDTO registrationRequest) {
    ApplicationDTO applicationDTO = null;
    try {
        Application application = DCRMUtils.getOAuth2DCRMService().registerApplication(DCRMUtils.getApplicationRegistrationRequest(registrationRequest));
        applicationDTO = DCRMUtils.getApplicationDTOFromApplication(application);
    } catch (DCRMClientException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Client error while registering application \n" + registrationRequest.toString(), e);
        }
        DCRMUtils.handleErrorResponse(e, LOG);
    } catch (DCRMServerException e) {
        DCRMUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, e, true, LOG);
    } catch (Throwable throwable) {
        DCRMUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, throwable, true, LOG);
    }
    return Response.status(Response.Status.CREATED).entity(applicationDTO).build();
}
Also used : ApplicationDTO(org.wso2.carbon.identity.oauth2.dcr.endpoint.dto.ApplicationDTO) DCRMClientException(org.wso2.carbon.identity.oauth.dcr.exception.DCRMClientException) DCRMServerException(org.wso2.carbon.identity.oauth.dcr.exception.DCRMServerException) Application(org.wso2.carbon.identity.oauth.dcr.bean.Application)

Example 53 with ApplicationDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project identity-inbound-auth-oauth by wso2-extensions.

the class RegisterApiServiceImpl method getApplicationByName.

@Override
public Response getApplicationByName(String name) {
    ApplicationDTO applicationDTO = null;
    try {
        Application application = DCRMUtils.getOAuth2DCRMService().getApplicationByName(name);
        applicationDTO = DCRMUtils.getApplicationDTOFromApplication(application);
    } catch (DCRMClientException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Client error while retrieving application by name : " + name, e);
        }
        DCRMUtils.handleErrorResponse(e, LOG);
    } catch (Exception e) {
        DCRMUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, e, true, LOG);
    }
    return Response.status(Response.Status.OK).entity(applicationDTO).build();
}
Also used : ApplicationDTO(org.wso2.carbon.identity.oauth2.dcr.endpoint.dto.ApplicationDTO) DCRMClientException(org.wso2.carbon.identity.oauth.dcr.exception.DCRMClientException) Application(org.wso2.carbon.identity.oauth.dcr.bean.Application) DCRMClientException(org.wso2.carbon.identity.oauth.dcr.exception.DCRMClientException) DCRMServerException(org.wso2.carbon.identity.oauth.dcr.exception.DCRMServerException)

Example 54 with ApplicationDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project identity-inbound-auth-oauth by wso2-extensions.

the class RegisterApiServiceImpl method getApplication.

@Override
public Response getApplication(String clientId) {
    ApplicationDTO applicationDTO = null;
    try {
        Application application = DCRMUtils.getOAuth2DCRMService().getApplication(clientId);
        applicationDTO = DCRMUtils.getApplicationDTOFromApplication(application);
    } catch (DCRMClientException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Client error while retrieving  application with client key:" + clientId, e);
        }
        DCRMUtils.handleErrorResponse(e, LOG);
    } catch (DCRMServerException e) {
        DCRMUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, e, true, LOG);
    } catch (Throwable throwable) {
        DCRMUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, throwable, true, LOG);
    }
    return Response.status(Response.Status.OK).entity(applicationDTO).build();
}
Also used : ApplicationDTO(org.wso2.carbon.identity.oauth2.dcr.endpoint.dto.ApplicationDTO) DCRMClientException(org.wso2.carbon.identity.oauth.dcr.exception.DCRMClientException) DCRMServerException(org.wso2.carbon.identity.oauth.dcr.exception.DCRMServerException) Application(org.wso2.carbon.identity.oauth.dcr.bean.Application)

Example 55 with ApplicationDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project identity-api-user by wso2.

the class ApplicationToExternal method apply.

@Override
public ApplicationDTO apply(Application application) {
    ApplicationDTO applicationDTO = new ApplicationDTO();
    applicationDTO.setId(application.getResourceId());
    applicationDTO.setAppId(application.getAppId());
    applicationDTO.setSubject(application.getSubject());
    applicationDTO.setAppName(application.getAppName());
    return applicationDTO;
}
Also used : ApplicationDTO(org.wso2.carbon.identity.rest.api.user.session.v1.dto.ApplicationDTO)

Aggregations

BeforeClass (org.testng.annotations.BeforeClass)17 ApplicationDTO (org.wso2.micro.gateway.tests.common.model.ApplicationDTO)17 Application (org.wso2.carbon.apimgt.core.models.Application)11 ApplicationDTO (org.wso2.carbon.apimgt.rest.api.store.dto.ApplicationDTO)11 ArrayList (java.util.ArrayList)10 JSONObject (org.json.JSONObject)10 HashMap (java.util.HashMap)9 Application (org.wso2.carbon.apimgt.api.model.Application)8 API (org.wso2.micro.gateway.tests.common.model.API)8 APIStore (org.wso2.carbon.apimgt.core.api.APIStore)7 ExportedApplication (org.wso2.carbon.apimgt.rest.api.store.v1.models.ExportedApplication)7 KeyValidationInfo (org.wso2.micro.gateway.tests.common.KeyValidationInfo)7 MockAPIPublisher (org.wso2.micro.gateway.tests.common.MockAPIPublisher)7 Test (org.junit.Test)6 APIConsumer (org.wso2.carbon.apimgt.api.APIConsumer)6 ApplicationKeysDTO (org.wso2.carbon.apimgt.rest.api.store.dto.ApplicationKeysDTO)6 ApplicationDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO)6 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)5 WorkflowResponse (org.wso2.carbon.apimgt.core.api.WorkflowResponse)5 ApplicationCreationResponse (org.wso2.carbon.apimgt.core.workflow.ApplicationCreationResponse)5