mirror of
https://repository.entgra.net/community/product-iots.git
synced 2025-09-16 23:32:19 +00:00
appended tenant domain to username
This commit is contained in:
parent
06cf7a7eee
commit
8e71da6c15
@ -357,6 +357,7 @@ public class DeviceTypeServiceImpl implements DeviceTypeService {
|
|||||||
if (apiApplicationKey == null) {
|
if (apiApplicationKey == null) {
|
||||||
String applicationUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm()
|
String applicationUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm()
|
||||||
.getRealmConfiguration().getAdminUserName();
|
.getRealmConfiguration().getAdminUserName();
|
||||||
|
applicationUsername = applicationUsername + "@" + APIUtil.getAuthenticatedUserTenantDomain();
|
||||||
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
|
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
|
||||||
String[] tags = {DeviceTypeConstants.DEVICE_TYPE};
|
String[] tags = {DeviceTypeConstants.DEVICE_TYPE};
|
||||||
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
|
apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
|
||||||
@ -365,7 +366,8 @@ public class DeviceTypeServiceImpl implements DeviceTypeService {
|
|||||||
JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient();
|
JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient();
|
||||||
String scopes = "device_type_" + DeviceTypeConstants.DEVICE_TYPE + " device_" + deviceId;
|
String scopes = "device_type_" + DeviceTypeConstants.DEVICE_TYPE + " device_" + deviceId;
|
||||||
AccessTokenInfo accessTokenInfo = jwtClient.getAccessToken(apiApplicationKey.getConsumerKey(),
|
AccessTokenInfo accessTokenInfo = jwtClient.getAccessToken(apiApplicationKey.getConsumerKey(),
|
||||||
apiApplicationKey.getConsumerSecret(), owner, scopes);
|
apiApplicationKey.getConsumerSecret(), owner + "@" + APIUtil.getAuthenticatedUserTenantDomain(), scopes);
|
||||||
|
|
||||||
//create token
|
//create token
|
||||||
String accessToken = accessTokenInfo.getAccessToken();
|
String accessToken = accessTokenInfo.getAccessToken();
|
||||||
String refreshToken = accessTokenInfo.getRefreshToken();
|
String refreshToken = accessTokenInfo.getRefreshToken();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user