Skip to content

Commit

Permalink
Set JWT for portal login
Browse files Browse the repository at this point in the history
  • Loading branch information
chamilaadhi committed Mar 3, 2024
1 parent 19a15c8 commit e2b1230
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions portals/admin/src/main/webapp/services/login/idp.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@
dcrRequestData.put("grantType", "authorization_code refresh_token");
dcrRequestData.put("saasApp", true);
Object isJWTEnabledObj = Util.readJsonObj(settingsResponse, "IsJWTEnabledForLoginTokens");
if (isJWTEnabledObj != null && isJWTEnabledObj instanceof Boolean) {
boolean isJWTEnabledForLoginTokens = (boolean) isJWTEnabledObj;
if (isJWTEnabledForLoginTokens) {
dcrRequestData.put("tokenType", "JWT");
dcrRequestData.put("userStoreDomainInSubject", true);
}
}
HttpRequest postReq = HttpRequest.newBuilder()
.uri(URI.create(dcrUrl))
.POST(HttpRequest.BodyPublishers.ofString(gson.toJson(dcrRequestData)))
Expand Down
10 changes: 10 additions & 0 deletions portals/devportal/src/main/webapp/services/login/idp.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@
dcrRequestData.put("owner", (String) APIUtil.getTenantAdminUserName(serviceProviderTenantDomain));
dcrRequestData.put("grantType", "authorization_code refresh_token");
dcrRequestData.put("saasApp", true);
Object isJWTEnabledObj = Util.readJsonObj(settingsResponse, "IsJWTEnabledForLoginTokens");
if (isJWTEnabledObj != null && isJWTEnabledObj instanceof Boolean) {
boolean isJWTEnabledForLoginTokens = (boolean) isJWTEnabledObj;
if (isJWTEnabledForLoginTokens) {
dcrRequestData.put("tokenType", "JWT");
dcrRequestData.put("userStoreDomainInSubject", true);
}
}
log.debug(dcrRequestData);
HttpRequest postReq = HttpRequest.newBuilder()
.uri(URI.create(dcrUrl))
Expand Down
9 changes: 9 additions & 0 deletions portals/publisher/src/main/webapp/services/login/idp.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@
dcrRequestData.put("grantType", "authorization_code refresh_token");
dcrRequestData.put("saasApp", true);
Object isJWTEnabledObj = Util.readJsonObj(settingsResponse, "IsJWTEnabledForLoginTokens");
if (isJWTEnabledObj != null && isJWTEnabledObj instanceof Boolean) {
boolean isJWTEnabledForLoginTokens = (boolean) isJWTEnabledObj;
if (isJWTEnabledForLoginTokens) {
dcrRequestData.put("tokenType", "JWT");
dcrRequestData.put("userStoreDomainInSubject", true);
}
}
HttpRequest postReq = HttpRequest.newBuilder()
.uri(URI.create(dcrUrl))
.POST(HttpRequest.BodyPublishers.ofString(gson.toJson(dcrRequestData)))
Expand Down

0 comments on commit e2b1230

Please sign in to comment.