Improvements in consumer rest APIS

remotes/1725563413541109883/master
commit f587e2a38f

@ -118,9 +118,10 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
for (String tag: tags) {
Map<String, String> queryParams = new HashMap<>();
Map<String, String> headerParams = new HashMap<>();
queryParams.put("tag", tag);
if ("carbon.super".equals(tenantDomain)) {
consumerRESTAPIServices.getAllApis(null, null, queryParams);
consumerRESTAPIServices.getAllApis(null, null, queryParams, headerParams);
} else {
//call All API getting call with carbon super header param
}

@ -26,6 +26,12 @@ public interface APIApplicationServices {
APIApplicationKey createAndRetrieveApplicationCredentials() throws APIServicesException;
APIApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[],
String keyType, String username,
boolean isAllowedAllDomains,
String validityTime, String password)
throws APIServicesException;
AccessTokenInfo generateAccessTokenFromRegisteredApplication(String clientId, String clientSecret) throws APIServicesException;
AccessTokenInfo generateAccessTokenFromRefreshToken(String refreshToken, String clientId, String clientSecret) throws APIServicesException;

@ -35,6 +35,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.impl.APIManagerConfiguration;
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
import java.io.IOException;
public class APIApplicationServicesImpl implements APIApplicationServices {
@ -78,6 +79,38 @@ public class APIApplicationServicesImpl implements APIApplicationServices {
}
}
@Override
public APIApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[],
String keyType, String username,
boolean isAllowedAllDomains,
String validityTime, String password)
throws APIServicesException {
String applicationEndpoint = config.getFirstProperty(Constants.DCR_END_POINT);
JSONObject jsonObject = new JSONObject();
jsonObject.put("callbackUrl", Constants.EMPTY_STRING);
jsonObject.put("clientName", username);
jsonObject.put("grantType", Constants.GRANT_TYPE);
jsonObject.put("owner", username);
jsonObject.put("saasApp", true);
RequestBody requestBody = RequestBody.Companion.create(jsonObject.toString(), JSON);
Request request = new Request.Builder()
.url(applicationEndpoint)
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Credentials.basic(username, password))
.post(requestBody)
.build();
try {
Response response = client.newCall(request).execute();
return gson.fromJson(response.body().string(), APIApplicationKey.class);
} catch (IOException e) {
msg = "Error occurred while processing the response";
log.error(msg, e);
throw new APIServicesException(e);
}
}
@Override
public AccessTokenInfo generateAccessTokenFromRegisteredApplication(String consumerKey, String consumerSecret)
throws APIServicesException {

@ -18,40 +18,45 @@
package io.entgra.device.mgt.core.apimgt.extension.rest.api;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.APIInfo;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.APIKey;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Subscription;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.KeyManager;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException;
import org.json.JSONObject;
import java.util.List;
import java.util.Map;
public interface ConsumerRESTAPIServices {
JSONObject getAllApplications(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String appName)
Application[] getAllApplications(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String appName)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
Application getDetailsOfAnApplication(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
String applicationId)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
Application createApplication(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Application application)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
JSONObject getAllSubscriptions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Subscription[] getAllSubscriptions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
String applicationId)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
JSONObject getAllApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Map<String, String> queryParam)
APIInfo[] getAllApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Map<String, String> queryParam, Map<String, String> headerParams)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
Subscription createSubscription(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Subscription subscriptions)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
Subscription createSubscriptions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Subscription[] createSubscriptions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
List<Subscription> subscriptions)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
@ -59,6 +64,6 @@ public interface ConsumerRESTAPIServices {
String applicationId)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
JSONObject getAllKeyManagers(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo)
KeyManager[] getAllKeyManagers(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo)
throws APIServicesException, BadRequestException, UnexpectedResponseException;
}

@ -19,9 +19,11 @@
package io.entgra.device.mgt.core.apimgt.extension.rest.api;
import com.google.gson.Gson;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.APIInfo;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.APIKey;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Application;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Subscription;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.KeyManager;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo;
@ -33,6 +35,7 @@ import okhttp3.*;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
@ -51,7 +54,7 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
+ Constants.COLON + port;
@Override
public JSONObject getAllApplications(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String appName)
public Application[] getAllApplications(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String appName)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
String getAllApplicationsUrl = endPointPrefix + Constants.APPLICATIONS_API + "?query=" + appName;
@ -65,8 +68,8 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
try {
Response response = client.newCall(request).execute();
if (HttpStatus.SC_OK == response.code()) {
JSONObject jsonObject = new JSONObject(response.body().string());
return jsonObject;
JSONArray applicationList = (JSONArray) new JSONObject(response.body().string()).get("list");
return gson.fromJson(applicationList.toString(), Application[].class);
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
AccessTokenInfo refreshedAccessToken = apiApplicationServices.
@ -89,6 +92,45 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
}
}
@Override
public Application getDetailsOfAnApplication(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
String applicationId)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
String getAllApplicationsUrl = endPointPrefix + Constants.APPLICATIONS_API + Constants.SLASH + applicationId;
Request request = new Request.Builder()
.url(getAllApplicationsUrl)
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
+ accessTokenInfo.getAccess_token())
.get()
.build();
try {
Response response = client.newCall(request).execute();
if (HttpStatus.SC_OK == response.code()) {
return gson.fromJson(response.body().string(), Application.class);
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
AccessTokenInfo refreshedAccessToken = apiApplicationServices.
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
//TODO: max attempt count
return getDetailsOfAnApplication(apiApplicationKey, refreshedAccessToken, applicationId);
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
String msg = "Bad Request, Invalid request";
log.error(msg);
throw new BadRequestException(msg);
} else {
String msg = "Response : " + response.code() + response.body();
throw new UnexpectedResponseException(msg);
}
} catch (IOException e) {
String msg = "Error occurred while processing the response";
log.error(msg, e);
throw new APIServicesException(msg, e);
}
}
@Override
public Application createApplication(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Application application)
@ -141,7 +183,7 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
}
@Override
public JSONObject getAllSubscriptions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
public Subscription[] getAllSubscriptions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
String applicationId)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
@ -156,8 +198,8 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
try {
Response response = client.newCall(request).execute();
if (HttpStatus.SC_OK == response.code()) {
JSONObject jsonObject = new JSONObject(response.body().string());
return jsonObject;
JSONArray subscriptionList = (JSONArray) new JSONObject(response.body().string()).get("list");
return gson.fromJson(subscriptionList.toString(), Subscription[].class);
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
AccessTokenInfo refreshedAccessToken = apiApplicationServices.
@ -181,8 +223,8 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
}
@Override
public JSONObject getAllApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Map<String, String> queryParams)
public APIInfo[] getAllApis(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
Map<String, String> queryParams, Map<String, String> headerParams)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
String getAPIsURL = endPointPrefix + Constants.DEV_PORTAL_API;
@ -191,25 +233,28 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
getAPIsURL = getAPIsURL + Constants.AMPERSAND + query.getKey() + Constants.EQUAL + query.getValue();
}
Request request = new Request.Builder()
.url(getAPIsURL)
.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
+ accessTokenInfo.getAccess_token())
.get()
.build();
Request.Builder builder = new Request.Builder();
builder.url(getAPIsURL);
builder.addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER
+ accessTokenInfo.getAccess_token());
for (Map.Entry<String, String> header : headerParams.entrySet()) {
builder.addHeader(header.getKey(), header.getValue());
}
builder.get();
Request request = builder.build();
try {
Response response = client.newCall(request).execute();
if (HttpStatus.SC_OK == response.code()) {
JSONObject jsonObject = new JSONObject(response.body().string());
return jsonObject;
JSONArray apiList = (JSONArray) new JSONObject(response.body().string()).get("list");
return gson.fromJson(apiList.toString(), APIInfo[].class);
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
AccessTokenInfo refreshedAccessToken = apiApplicationServices.
generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(),
apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret());
//TODO: max attempt count
return getAllApis(apiApplicationKey, refreshedAccessToken, queryParams);
return getAllApis(apiApplicationKey, refreshedAccessToken, queryParams, headerParams);
} else if (HttpStatus.SC_BAD_REQUEST == response.code()) {
String msg = "Bad Request, Invalid request";
log.error(msg);
@ -274,7 +319,7 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
}
@Override
public Subscription createSubscriptions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
public Subscription[] createSubscriptions(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo,
List<Subscription> subscriptions)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
@ -293,7 +338,8 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
try {
Response response = client.newCall(request).execute();
if (HttpStatus.SC_OK == response.code()) {
return gson.fromJson(response.body().string(), Subscription.class);
JSONArray subscriptionsArray = (JSONArray) new JSONObject(response.body().string()).get("list");
return gson.fromJson(subscriptionsArray.toString(), Subscription[].class);
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
AccessTokenInfo refreshedAccessToken = apiApplicationServices.
@ -364,7 +410,7 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
}
@Override
public JSONObject getAllKeyManagers(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo)
public KeyManager[] getAllKeyManagers(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo)
throws APIServicesException, BadRequestException, UnexpectedResponseException {
String getAllKeyManagersUrl = endPointPrefix + Constants.KEY_MANAGERS_API;
@ -378,8 +424,8 @@ public class ConsumerRESTAPIServicesImpl implements ConsumerRESTAPIServices {
try {
Response response = client.newCall(request).execute();
if (HttpStatus.SC_OK == response.code()) {
JSONObject jsonObject = new JSONObject(response.body().string());
return jsonObject;
JSONArray keyManagerList = (JSONArray) new JSONObject(response.body().string()).get("list");
return gson.fromJson(keyManagerList.toString(), KeyManager[].class);
} else if (HttpStatus.SC_UNAUTHORIZED == response.code()) {
APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl();
AccessTokenInfo refreshedAccessToken = apiApplicationServices.

@ -0,0 +1,312 @@
/*
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.ScopeUtils;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* This class represents the Consumer API Information.
*/
public class APIInfo {
private String id;
private String name;
private String description;
private String context;
private String version;
private String provider;
private JSONObject apiDefinition;
private String wsdlUri;
private String lifeCycleStatus;
private boolean isDefaultVersion;
private String type;
private Set<String> transport;
private List<JSONObject> operations;
private String authorizationHeader;
private String securityScheme;
private Set<String> tags;
private List<JSONObject> tiers;
private boolean hasThumbnail;
private String additionalProperties;
private JSONObject monetization;
private List<JSONObject> endpointURLs;
private JSONObject businessInformation;
private List<JSONObject> environmentList;
private List<ScopeUtils> scopes;
private String avgRating;
private JSONObject advertiseInfo;
private boolean isSubscriptionAvailable;
private List<JSONObject> categories;
private List<String> keyManagers = new ArrayList();
private String createdTime;
private String lastUpdatedTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getProvider() {
return provider;
}
public void setProvider(String provider) {
this.provider = provider;
}
public JSONObject getApiDefinition() {
return apiDefinition;
}
public void setApiDefinition(JSONObject apiDefinition) {
this.apiDefinition = apiDefinition;
}
public String getWsdlUri() {
return wsdlUri;
}
public void setWsdlUri(String wsdlUri) {
this.wsdlUri = wsdlUri;
}
public String getLifeCycleStatus() {
return lifeCycleStatus;
}
public void setLifeCycleStatus(String lifeCycleStatus) {
this.lifeCycleStatus = lifeCycleStatus;
}
public boolean isDefaultVersion() {
return isDefaultVersion;
}
public void setDefaultVersion(boolean defaultVersion) {
isDefaultVersion = defaultVersion;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Set<String> getTransport() {
return transport;
}
public void setTransport(Set<String> transport) {
this.transport = transport;
}
public List<JSONObject> getOperations() {
return operations;
}
public void setOperations(List<JSONObject> operations) {
this.operations = operations;
}
public String getAuthorizationHeader() {
return authorizationHeader;
}
public void setAuthorizationHeader(String authorizationHeader) {
this.authorizationHeader = authorizationHeader;
}
public String getSecurityScheme() {
return securityScheme;
}
public void setSecurityScheme(String securityScheme) {
this.securityScheme = securityScheme;
}
public Set<String> getTags() {
return tags;
}
public void setTags(Set<String> tags) {
this.tags = tags;
}
public List<JSONObject> getTiers() {
return tiers;
}
public void setTiers(List<JSONObject> tiers) {
this.tiers = tiers;
}
public boolean isHasThumbnail() {
return hasThumbnail;
}
public void setHasThumbnail(boolean hasThumbnail) {
this.hasThumbnail = hasThumbnail;
}
public String getAdditionalProperties() {
return additionalProperties;
}
public void setAdditionalProperties(String additionalProperties) {
this.additionalProperties = additionalProperties;
}
public JSONObject getMonetization() {
return monetization;
}
public void setMonetization(JSONObject monetization) {
this.monetization = monetization;
}
public List<JSONObject> getEndpointURLs() {
return endpointURLs;
}
public void setEndpointURLs(List<JSONObject> endpointURLs) {
this.endpointURLs = endpointURLs;
}
public JSONObject getBusinessInformation() {
return businessInformation;
}
public void setBusinessInformation(JSONObject businessInformation) {
this.businessInformation = businessInformation;
}
public List<JSONObject> getEnvironmentList() {
return environmentList;
}
public void setEnvironmentList(List<JSONObject> environmentList) {
this.environmentList = environmentList;
}
public List<ScopeUtils> getScopes() {
return scopes;
}
public void setScopes(List<ScopeUtils> scopes) {
this.scopes = scopes;
}
public String getAvgRating() {
return avgRating;
}
public void setAvgRating(String avgRating) {
this.avgRating = avgRating;
}
public JSONObject getAdvertiseInfo() {
return advertiseInfo;
}
public void setAdvertiseInfo(JSONObject advertiseInfo) {
this.advertiseInfo = advertiseInfo;
}
public boolean isSubscriptionAvailable() {
return isSubscriptionAvailable;
}
public void setSubscriptionAvailable(boolean subscriptionAvailable) {
isSubscriptionAvailable = subscriptionAvailable;
}
public List<JSONObject> getCategories() {
return categories;
}
public void setCategories(List<JSONObject> categories) {
this.categories = categories;
}
public List<String> getKeyManagers() {
return keyManagers;
}
public void setKeyManagers(List<String> keyManagers) {
this.keyManagers = keyManagers;
}
public String getCreatedTime() {
return createdTime;
}
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
public String getLastUpdatedTime() {
return lastUpdatedTime;
}
public void setLastUpdatedTime(String lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
}
}

@ -18,6 +18,10 @@
package io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer;
/**
* This class represents the Consumer API Key Information.
*/
public class APIKey {
private String apikey;

@ -22,6 +22,10 @@ import org.json.JSONObject;
import java.util.List;
/**
* This class represents the Consumer Application Information.
*/
public class Application {
private String applicationId;
private String name;
@ -33,7 +37,7 @@ public class Application {
private int subscriptionCount;
private List<String> keys;
private JSONObject attributes;
private List<String> subscriptionScopes;
private List<Scopes> subscriptionScopes;
private String owner;
private boolean hashEnabled;
@ -117,11 +121,11 @@ public class Application {
this.attributes = attributes;
}
public List<String> getSubscriptionScopes() {
public List<Scopes> getSubscriptionScopes() {
return subscriptionScopes;
}
public void setSubscriptionScopes(List<String> subscriptionScopes) {
public void setSubscriptionScopes(List<Scopes> subscriptionScopes) {
this.subscriptionScopes = subscriptionScopes;
}

@ -0,0 +1,110 @@
/*
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer;
import io.apicurio.datamodels.asyncapi.v2.visitors.Aai20Traverser;
import java.util.List;
/**
* This class represents the Consumer Application configuration Information.
*/
public class ApplicationConfigurations {
private String name;
private String label;
private String type;
private boolean required;
private boolean mask;
private boolean multiple;
private String tooltip;
private List<String> values;
private String defaults;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean isRequired() {
return required;
}
public void setRequired(boolean required) {
this.required = required;
}
public boolean isMask() {
return mask;
}
public void setMask(boolean mask) {
this.mask = mask;
}
public boolean isMultiple() {
return multiple;
}
public void setMultiple(boolean multiple) {
this.multiple = multiple;
}
public String getTooltip() {
return tooltip;
}
public void setTooltip(String tooltip) {
this.tooltip = tooltip;
}
public List<String> getValues() {
return values;
}
public void setValues(List<String> values) {
this.values = values;
}
public String getDefaults() {
return defaults;
}
public void setDefaults(String defaults) {
this.defaults = defaults;
}
}

@ -0,0 +1,184 @@
/*
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer;
import org.json.JSONObject;
import java.util.List;
/**
* This class represents the Consumer Key manager Information.
*/
public class KeyManager {
private String id;
private String name;
private String type;
private String displayName;
private String description;
private boolean enabled;
private List<String> availableGrantTypes;
private String tokenEndpoint;
private String revokeEndpoint;
private String userInfoEndpoint;
private String enableTokenGeneration;
private String enableTokenEncryption;
private String enableTokenHashing;
private String enableOAuthAppCreation;
private String enableMapOAuthConsumerApps;
private List<ApplicationConfigurations> applicationConfiguration;
private JSONObject additionalProperties;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public List<String> getAvailableGrantTypes() {
return availableGrantTypes;
}
public void setAvailableGrantTypes(List<String> availableGrantTypes) {
this.availableGrantTypes = availableGrantTypes;
}
public String getTokenEndpoint() {
return tokenEndpoint;
}
public void setTokenEndpoint(String tokenEndpoint) {
this.tokenEndpoint = tokenEndpoint;
}
public String getRevokeEndpoint() {
return revokeEndpoint;
}
public void setRevokeEndpoint(String revokeEndpoint) {
this.revokeEndpoint = revokeEndpoint;
}
public String getUserInfoEndpoint() {
return userInfoEndpoint;
}
public void setUserInfoEndpoint(String userInfoEndpoint) {
this.userInfoEndpoint = userInfoEndpoint;
}
public String getEnableTokenGeneration() {
return enableTokenGeneration;
}
public void setEnableTokenGeneration(String enableTokenGeneration) {
this.enableTokenGeneration = enableTokenGeneration;
}
public String getEnableTokenEncryption() {
return enableTokenEncryption;
}
public void setEnableTokenEncryption(String enableTokenEncryption) {
this.enableTokenEncryption = enableTokenEncryption;
}
public String getEnableTokenHashing() {
return enableTokenHashing;
}
public void setEnableTokenHashing(String enableTokenHashing) {
this.enableTokenHashing = enableTokenHashing;
}
public String getEnableOAuthAppCreation() {
return enableOAuthAppCreation;
}
public void setEnableOAuthAppCreation(String enableOAuthAppCreation) {
this.enableOAuthAppCreation = enableOAuthAppCreation;
}
public String getEnableMapOAuthConsumerApps() {
return enableMapOAuthConsumerApps;
}
public void setEnableMapOAuthConsumerApps(String enableMapOAuthConsumerApps) {
this.enableMapOAuthConsumerApps = enableMapOAuthConsumerApps;
}
public List<ApplicationConfigurations> getApplicationConfiguration() {
return applicationConfiguration;
}
public void setApplicationConfiguration(List<ApplicationConfigurations> applicationConfiguration) {
this.applicationConfiguration = applicationConfiguration;
}
public JSONObject getAdditionalProperties() {
return additionalProperties;
}
public void setAdditionalProperties(JSONObject additionalProperties) {
this.additionalProperties = additionalProperties;
}
}

@ -0,0 +1,65 @@
/*
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer;
import java.util.List;
/**
* This class represents the scope data.
*/
public class Scopes {
private String key;
private String name;
private List<String> roles;
private String description;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getRoles() {
return roles;
}
public void setRoles(List<String> roles) {
this.roles = roles;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

@ -25,8 +25,8 @@ public class Subscription {
private String subscriptionId;
private String applicationId;
private String apiId;
private JSONObject apiInfo;
private JSONObject applicationInfo;
private APIInfo apiInfo;
private Application applicationInfo;
private String throttlingPolicy;
private String requestedThrottlingPolicy;
private String status;
@ -56,19 +56,19 @@ public class Subscription {
this.apiId = apiId;
}
public JSONObject getApiInfo() {
public APIInfo getApiInfo() {
return apiInfo;
}
public void setApiInfo(JSONObject apiInfo) {
public void setApiInfo(APIInfo apiInfo) {
this.apiInfo = apiInfo;
}
public JSONObject getApplicationInfo() {
public Application getApplicationInfo() {
return applicationInfo;
}
public void setApplicationInfo(JSONObject applicationInfo) {
public void setApplicationInfo(Application applicationInfo) {
this.applicationInfo = applicationInfo;
}

Loading…
Cancel
Save