Skip to content

Commit

Permalink
CLOUDSTACK-10101: Present the full domain name when listing user's do…
Browse files Browse the repository at this point in the history
…mains in SAML2 plugin (apache#2280)

This commit is related to the Saml2 user authentication plugin.

The user can list its domains. His/Her domains are presented as the
following example:
username/subdomainA
username/subdomainB

However, if a user has two subdomains of the same name Dom1/subdomainA
and Dom2/subdomainA, the list is presented as follows:
username/subdomainA
username/subdomainA

With this commit it shows the full domain name to avoid such cases.
Thus, the domains will be presented as follows:
username/Dom1/subdomainA
username/Dom2/subdomainA
  • Loading branch information
GabrielBrascher authored and rohityadavcloud committed Oct 10, 2017
1 parent b044f1b commit f1c01a5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public String authenticate(final String command, final Map<String, Object[]> par
accountResponse.setUserName(user.getUsername());
accountResponse.setDomainId(domain.getUuid());
accountResponse.setDomainName(domain.getName());
accountResponse.setDomainPath(domain.getPath());
accountResponse.setAccountName(userAccount.getAccountName());
accountResponse.setIdpId(user.getExternalEntity());
accountResponses.add(accountResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public class SamlUserAccountResponse extends AuthenticationCmdResponse {
@Param(description = "The IDP ID")
private String idpId;

@SerializedName("domainPath")
@Param(description = "The full qualified domain path")
private String domainPath;

public SamlUserAccountResponse() {
super();
setObjectName("samluseraccount");
Expand Down Expand Up @@ -96,4 +100,13 @@ public String getIdpId() {
public void setIdpId(String idpId) {
this.idpId = idpId;
}

public String getDomainPath() {
return domainPath;
}

public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}

}
5 changes: 4 additions & 1 deletion ui/scripts/ui-custom/saml.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@
option.data("userId", accounts[i].userId);
option.data("domainId", accounts[i].domainId);
option.val(accounts[i].userId + '/' + accounts[i].domainId);
option.html(accounts[i].accountName + "/" + accounts[i].domainName);
option.html(accounts[i].accountName + accounts[i].domainPath);
if (accounts[i].domainName == 'ROOT') {
option.append('ROOT');
}
option.appendTo($domainSelect);
}
var currentAccountDomain = g_userid + '/' + g_domainid;
Expand Down

0 comments on commit f1c01a5

Please sign in to comment.