-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tenant domain to jwt payload #2384
Conversation
@@ -641,6 +645,11 @@ public String getDeviceAuthzEPUrl() { | |||
|
|||
return deviceAuthzEPUrl; | |||
} | |||
|
|||
public boolean isAddTenantDomainToTokenEnabled() { | |||
return addTenantDomainToTokenEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new line after the method definition. Check other places as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed with 5ec7232
...tity.oauth/src/main/java/org/wso2/carbon/identity/oauth/config/OAuthServerConfiguration.java
Show resolved
Hide resolved
@@ -3348,6 +3369,8 @@ private class ConfigElements { | |||
private static final String OPENID_CONNECT_ADD_TENANT_DOMAIN_TO_ID_TOKEN = "AddTenantDomainToIdToken"; | |||
// Property to decide whether to add userstore domain to id_token. | |||
private static final String OPENID_CONNECT_ADD_USERSTORE_DOMAIN_TO_ID_TOKEN = "AddUserstoreDomainToIdToken"; | |||
// Enable/Disable adding domain information to the token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Enable/Disable adding domain information to the token | |
// Enable/Disable adding domain information to the token. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
private static final String APP_DOMAIN = "app_domain"; | ||
private static final String USER_DOMAIN = "user_domain"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we have the word tenant domain in the claim. specially when using user_domain this could be confused with userstore domian.
some suggetions,
app_domain -> app_td
user_domain -> user_td
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed as suggested
@@ -3348,6 +3370,8 @@ private class ConfigElements { | |||
private static final String OPENID_CONNECT_ADD_TENANT_DOMAIN_TO_ID_TOKEN = "AddTenantDomainToIdToken"; | |||
// Property to decide whether to add userstore domain to id_token. | |||
private static final String OPENID_CONNECT_ADD_USERSTORE_DOMAIN_TO_ID_TOKEN = "AddUserstoreDomainToIdToken"; | |||
// Enable/Disable adding domain information to the token. | |||
private static final String ADD_DOMAIN_TO_ACCESS_TOKEN = "AddTenantDomainToAccessToken"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final String ADD_DOMAIN_TO_ACCESS_TOKEN = "AddTenantDomainToAccessToken"; | |
private static final String ADD_TENANT_DOMAIN_TO_ACCESS_TOKEN = "AddTenantDomainToAccessToken"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
private static final String APP_DOMAIN = "app_td"; | ||
private static final String USER_DOMAIN = "user_td"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final String APP_DOMAIN = "app_td"; | |
private static final String USER_DOMAIN = "user_td"; | |
private static final String APP_TENANT_DOMAIN = "app_td"; | |
private static final String USER_TENANT_DOMAIN = "user_td"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -479,6 +481,11 @@ protected JWTClaimsSet createJWTClaimSet(OAuthAuthzReqMessageContext authAuthzRe | |||
jwtClaimsSetBuilder.notBeforeTime(new Date(curTimeInMillis)); | |||
jwtClaimsSetBuilder.claim(CLIENT_ID, consumerKey); | |||
|
|||
if (OAuthServerConfiguration.getInstance().isAddTenantDomainToAccessTokenEnabled()) { | |||
jwtClaimsSetBuilder.claim(APP_DOMAIN, oAuthAppDO.getAppOwner().getTenantDomain()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oAuthAppDO.getAppOwner().getTenantDomain() this seems to be resolving the tenant domain of the app through the appowners tenant domain. lets directly resolve the apps tenant domain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed changes in this pull request
When SP is created with saas app enabled, it is not possible to identify the tenant domain of the user. Also, it is not possible to identify the SP's tenant domain as well. For that had a chat with @janakamarasena and decided to introduce two new custom fields to the JWT token (
user_domain
andapp_domain
). It was decided to introduce a flag to enable this to the jwt.This will be enabled only if the following config is added
PR related to the config wso2/carbon-identity-framework#5547