cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karuturi <...@git.apache.org>
Subject [GitHub] cloudstack pull request: Cloudstack:8647 LDAP Trust AD and Autoimp...
Date Tue, 01 Sep 2015 09:25:01 GMT
Github user karuturi commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/755#discussion_r38400169
  
    --- Diff: plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
---
    @@ -52,21 +58,71 @@ public LdapAuthenticator(final LdapManager ldapManager, final UserAccountDao
use
                 return new Pair<Boolean, ActionOnFailedAuthentication>(false, null);
             }
     
    -        final UserAccount user = _userAccountDao.getUserAccount(username, domainId);
    +        boolean result = false;
    +        ActionOnFailedAuthentication action = null;
     
    -        if (user == null) {
    -            s_logger.debug("Unable to find user with " + username + " in domain " + domainId);
    -            return new Pair<Boolean, ActionOnFailedAuthentication>(false, null);
    -        } else if (_ldapManager.isLdapEnabled()) {
    -            boolean result = _ldapManager.canAuthenticate(username, password);
    -            ActionOnFailedAuthentication action = null;
    -            if (result == false) {
    +        if (_ldapManager.isLdapEnabled()) {
    +            final UserAccount user = _userAccountDao.getUserAccount(username, domainId);
    +            LdapTrustMapVO ldapTrustMapVO = _ldapManager.getDomainLinkedToLdap(domainId);
    +            if(ldapTrustMapVO != null) {
    +                try {
    +                    LdapUser ldapUser = _ldapManager.getUser(username, ldapTrustMapVO.getType().toString(),
ldapTrustMapVO.getName());
    +                    if(!ldapUser.isDisabled()) {
    +                        result = _ldapManager.canAuthenticate(ldapUser.getPrincipal(),
password);
    +                        if(result) {
    +                            if(user == null) {
    +                                // import user to cloudstack
    +                                createCloudStackUserAccount(ldapUser, domainId, ldapTrustMapVO.getAccountType());
    --- End diff --
    
    The second call to createUserAccount will fail and authentication will fail in the second
attempt. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message