-
Notifications
You must be signed in to change notification settings - Fork 99
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
Conversation
- 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
Can one of the admins verify this patch? |
2 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
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.
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 | ||
} |
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.
Please remove the invalid } char
throw new LoginException(sprintf('Couldn\'t connect to LDAP server')); | ||
} | ||
|
||
//Bind the authenticating user to the LDAP directory |
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 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())); | ||
} | ||
} |
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
throw new LoginException(sprintf('Failed to create principal: %s', $e->getMessage())); | ||
} | ||
} | ||
$ldap_connection = $this->ldapConnect(); |
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.
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); |
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.
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 { |
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 new line before ... and some docuentation
} | ||
try { | ||
$group->addMember($this->createIdentity(new String($name))); | ||
} catch (\Exception $e) { |
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.
What about logging here ???
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.
Please re-test my changes :)
Implemented an LdapLoginModule for the appserver
picketbox/jboss