use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project product-microgateway by wso2.
the class JwtTransformerTestCase method start.
@BeforeClass
public void start() throws Exception {
String project = "jwtTransformerProject";
// Define application info
Map<String, Object> claimMap = new HashMap<>();
ApplicationDTO application = new ApplicationDTO();
application.setName("jwtApp");
application.setTier("Unlimited");
application.setId((int) (Math.random() * 1000));
JSONArray scopes = new JSONArray();
scopes.add("admin");
scopes.add("write");
scopes.add("read");
claimMap.put("scp", scopes);
jwtTokenProdWithScopes = TokenUtil.getJwtWithCustomClaimsTransformer(application, new JSONObject(), TestConstant.KEY_TYPE_PRODUCTION, 3600, claimMap);
// generate apis with CLI and start the micro gateway server
super.init(project, new String[] { "jwtTransformer/jwt_transformer.yaml", "mgw-JwtValueTransformer.jar" }, null, "confs/jwt-transformer-test-config.conf");
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project product-microgateway by wso2.
the class EndpointsByReferenceTestCase method start.
@BeforeClass()
public void start() throws Exception {
String project = "EndpointReferenceProject";
// Define application info
ApplicationDTO application = new ApplicationDTO();
application.setName("jwtApp");
application.setTier("Unlimited");
application.setId((int) (Math.random() * 1000));
jwtTokenProd = TokenUtil.getBasicJWT(application, new JSONObject(), TestConstant.KEY_TYPE_PRODUCTION, 3600);
String[] args = { "--myEndpoint1_prod_endpoint_0=https://localhost:2380/v1", "--myEndpoint2_prod_endpoint_0=https://localhost:2380/v2", "--myEndpoint3_prod_endpoint_0=https://localhost:2380/v1", "--myEndpoint3_prod_endpoint_1=https://localhost:2380/v2", "--myEndpoint4_prod_endpoint_1=https://localhost:2380/v2", "--myEndpoint1_prod_basic_password=admin", "--myEndpoint2_prod_basic_password=admin", "--myEndpoint3_prod_basic_password=admin", "--myEndpoint4_prod_basic_password=admin" };
// generate apis with CLI and start the micro gateway server
super.init(project, new String[] { "endpoints/endpoints_by_reference.yaml", "endpoints/endpoint_override.yaml", "endpoints/load_balance.yaml", "endpoints/fail_over.yaml", "endpoints/endpoint_security.yaml", "endpoints/advance_config.yaml", "endpoints/resource_endpoints_only.yaml" }, args);
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project product-microgateway by wso2.
the class OASAPIInvokeTestCase method start.
@BeforeClass
public void start() throws Exception {
String project = "OpenApiThrottlingProject";
API api = new API();
api.setName("PetStoreAPI");
api.setContext("petstore/v1");
api.setProdEndpoint(getMockServiceURLHttp("/echo/prod"));
api.setVersion("1.0.0");
api.setProvider("admin");
// Define application info
ApplicationDTO application = new ApplicationDTO();
application.setName("jwtApp");
application.setTier("Unlimited");
application.setId((int) (Math.random() * 1000));
jwtTokenProd = getJWT(api, application, "Unlimited", TestConstant.KEY_TYPE_PRODUCTION, 3600);
// generate apis with CLI and start the micro gateway server
super.init(project, new String[] { "common_api.yaml", "throttling/throttle.yaml" });
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project product-microgateway by wso2.
the class APIKeyTestCase method start.
@BeforeClass
public void start() throws Exception {
ApplicationDTO application = new ApplicationDTO();
application.setName("jwtApp");
application.setTier("Unlimited");
application.setId((int) (Math.random() * 1000));
jwtTokenProd = TokenUtil.getBasicJWT(application, new JSONObject(), TestConstant.KEY_TYPE_PRODUCTION, 3600);
apiKeywithoutAllowedAPIs = "eyJhbGciOiJSUzI1NiIsICJ0eXAiOiJqd3QiLCAia2lkIjoiYmFsbGVyaW5hIn0.eyJzdWIiOiJhZG1pbiIsICJpc3M" + "iOiJodHRwczovL2xvY2FsaG9zdDo5MDk1L2FwaWtleSIsICJpYXQiOjE1ODIwMTczNTMsICJqdGkiOiI5NGFkNTk3NC1lZDI0L" + "TRjYmQtOWZlNi1iMGNmMjU5MTQ5ZDEiLCAiYXVkIjoiaHR0cDovL29yZy53c28yLmFwaW1ndC9nYXRld2F5IiwgImtleXR5cGU" + "iOiJQUk9EVUNUSU9OIiwgImFsbG93ZWRBUElzIjpbXX0.BaV6hsJUxoVEoZv2DpEg7PaE4z4q4RQ8lMLDLFDROcN5H7V4moTlk" + "Gb9tl0p3fZLPq4TGfddi53qiApQsgHG9hdd8XqrlAC47fq2ZHR-VAnWju3N-irqA6q75vfaz3g0X2A2t5e8zzcCt5YkA5ySCjI" + "FLHLR3Dxv3XBgpG7n9A8TwVywD64AZAhtnC-wgbX0uuTUSpK7BCPm-s34bChb4asrAKkDYUqzFmZTQDmL6t5lJ7QAhm3UrwuI2" + "wCAEZb6hu2YCZsrOLsX76t-2Evkx4Na-3sWIfb_2v5Arbd7PhjS6t0m5wpxCJGChDuP7dLZOXhjZGykg02uUxSt07ys1A";
super.init("api-key-project", new String[] { "common_api.yaml" }, null, "confs/api-key.conf");
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationDTO in project product-microgateway by wso2.
the class BaseTestCase method getJWT.
protected String getJWT(API api, ApplicationDTO applicationDTO, String tier, String keyType, int validityPeriod) throws Exception {
SubscribedApiDTO subscribedApiDTO = new SubscribedApiDTO();
subscribedApiDTO.setContext(api.getContext() + "/" + api.getVersion());
subscribedApiDTO.setName(api.getName());
subscribedApiDTO.setVersion(api.getVersion());
subscribedApiDTO.setPublisher("admin");
subscribedApiDTO.setSubscriptionTier(tier);
subscribedApiDTO.setSubscriberTenantDomain("carbon.super");
JSONObject jwtTokenInfo = new JSONObject();
jwtTokenInfo.put("subscribedAPIs", new JSONArray(Arrays.asList(subscribedApiDTO)));
return TokenUtil.getBasicJWT(applicationDTO, jwtTokenInfo, keyType, validityPeriod);
}
Aggregations