Skip to content
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

Implemented LdapLoginModule #1058

Merged
merged 6 commits into from
May 24, 2017
Merged

Implemented LdapLoginModule #1058

merged 6 commits into from
May 24, 2017

Conversation

AW3i
Copy link
Contributor

@AW3i AW3i commented May 9, 2017

Implemented an LdapLoginModule for the appserver

  • This module is able to bind and authenticate to an OpenLdap server, either anonymously or with a user bind
  • The module can find the roles of the user authenticating and passthem on to the appserver authentication manager
  • Implmentation is loosely based on LdapExtLoginModule from
    picketbox/jboss

AW3i added 2 commits May 9, 2017 13:31
    - This module is able to bind and authenticate to an OpenLdap
    server, either anonymously or with a user bind
    - The module can find the roles of the user authenticating and pass
    them on to the appserver authentication manager
    - Implmentation is loosely based on LdapExtLoginModule from
    picketbox
@appserver-ci
Copy link
Contributor

Can one of the admins verify this patch?

2 similar comments
@appserver-ci
Copy link
Contributor

Can one of the admins verify this patch?

@appserver-ci
Copy link
Contributor

Can one of the admins verify this patch?

Copy link
Member

@wagnert wagnert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addes some change requestes. Please check these and refactor where necessary :)

* This source file is subject to the Open Software License (OSL 3.0)
* that is available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the invalid } char

throw new LoginException(sprintf('Couldn\'t connect to LDAP server'));
}

//Bind the authenticating user to the LDAP directory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a whitespace between "//" and "Bind" and always start comments with lower case

} catch (\Exception $e) {
throw new LoginException(sprintf('Failed to create principal: %s', $e->getMessage()));
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line

throw new LoginException(sprintf('Failed to create principal: %s', $e->getMessage()));
}
}
$ldap_connection = $this->ldapConnect();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to

if ($ldapConnection = $this->ldapConnect()) {
...
}

and ALWAYS use camel case notation, means $ldap_connection should be $ldapConnection.

protected function ldapConnect()
{

$ldap_connection = ldap_connect($this->ldapUrl, $this->ldapPort);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also use camel case notation $ldapConnection

$this->roleFilter = preg_replace("/\{1\}/", "$userDN", $this->roleFilter);
$search = ldap_search($ldap_connection, $this->rolesDN, $this->roleFilter);
$entry = ldap_first_entry($ldap_connection, $search);
do {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add new line before ... and some docuentation

}
try {
$group->addMember($this->createIdentity(new String($name)));
} catch (\Exception $e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about logging here ???

Copy link
Member

@wagnert wagnert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-test my changes :)

@wagnert wagnert merged commit 613a0b8 into appserver-io:master May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants