From 24fad779de4048b6c9a754658a392bd513cb5906 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Tue, 16 Mar 2021 08:26:05 +0530 Subject: [PATCH] Add token expiry time to QR payload --- .../application/extension/APIManagementProviderService.java | 3 ++- .../extension/APIManagementProviderServiceImpl.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java index 83cfbabf554..62d353d0fd1 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java @@ -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.exception.APIManagerException; 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. @@ -88,7 +89,7 @@ public interface APIManagementProviderService { * @throws APIManagerException if error occurred while getting the access token for given scopes, * 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; } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java index 1a77dbf680a..0c957fd4e71 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -238,7 +238,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe } @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 { try { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true); @@ -262,7 +262,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe .getAccessToken(clientCredentials.getConsumerKey(), clientCredentials.getConsumerSecret(), user, scopes); - return accessTokenForAdmin.getAccessToken(); + return accessTokenForAdmin; } catch (JWTClientException e) { String msg = "JWT Error occurred while registering Application to get access token."; log.error(msg, e);