Merge pull request #889 from lasanthaDLPDS/master

Add device remote controlling for tenants
revert-dabc3590
Charitha Goonetilleke 7 years ago committed by GitHub
commit a6e0414d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -189,11 +189,16 @@ function onRequest(context) {
var jwtService = carbonServer.osgiService('org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService');
var jwtClient = jwtService.getJWTClient();
var encodedClientKeys = session.get(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"]);
var tokenPair = null;
var token = "";
if (encodedClientKeys) {
var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"];
var resp = tokenUtil.decode(encodedClientKeys).split(":");
var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {});
if (context.user.domain == "carbon.super") {
tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {});
} else {
tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + context.user.domain,"default", {});
}
if (tokenPair) {
token = tokenPair.accessToken;
}

Loading…
Cancel
Save