Merge branch 'master' into 'master'

Add token expiry time to QR payload

See merge request entgra/carbon-device-mgt!745
master
Inosh Perara 4 years ago
commit e0669d3898

@ -21,6 +21,7 @@ package org.wso2.carbon.apimgt.application.extension;
import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey; import org.wso2.carbon.apimgt.application.extension.dto.ApiApplicationKey;
import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException; import org.wso2.carbon.apimgt.application.extension.exception.APIManagerException;
import org.wso2.carbon.apimgt.integration.client.store.StoreClient; import org.wso2.carbon.apimgt.integration.client.store.StoreClient;
import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo;
/** /**
* This comprise on operation that is been done with api manager from CDMF. This service needs to be implemented in APIM. * This comprise on operation that is been done with api manager from CDMF. This service needs to be implemented in APIM.
@ -88,7 +89,7 @@ public interface APIManagementProviderService {
* @throws APIManagerException if error occurred while getting the access token for given scopes, * @throws APIManagerException if error occurred while getting the access token for given scopes,
* validity period etc. * validity period etc.
*/ */
String getAccessToken(String scopes, String[] tags, String applicationName, String tokenType, String validityPeriod) AccessTokenInfo getAccessToken(String scopes, String[] tags, String applicationName, String tokenType, String validityPeriod)
throws APIManagerException; throws APIManagerException;
} }

@ -238,7 +238,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
} }
@Override @Override
public String getAccessToken(String scopes, String[] tags, String applicationName, String tokenType, public AccessTokenInfo getAccessToken(String scopes, String[] tags, String applicationName, String tokenType,
String validityPeriod) throws APIManagerException { String validityPeriod) throws APIManagerException {
try { try {
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
@ -262,7 +262,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
.getAccessToken(clientCredentials.getConsumerKey(), clientCredentials.getConsumerSecret(), user, .getAccessToken(clientCredentials.getConsumerKey(), clientCredentials.getConsumerSecret(), user,
scopes); scopes);
return accessTokenForAdmin.getAccessToken(); return accessTokenForAdmin;
} catch (JWTClientException e) { } catch (JWTClientException e) {
String msg = "JWT Error occurred while registering Application to get access token."; String msg = "JWT Error occurred while registering Application to get access token.";
log.error(msg, e); log.error(msg, e);

Loading…
Cancel
Save