From 0e7c445a56616667a958fb837717284f7ef2c350 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 83cfbabf55..62d353d0fd 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 1a77dbf680..0c957fd4e7 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);