This repository was archived by the owner on Feb 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +27
-20
lines changed Expand file tree Collapse file tree 5 files changed +27
-20
lines changed Original file line number Diff line number Diff line change 11Active Directory and LDAP authentication for Kohana
22===================================================
33
4- A wrapper module for [ Kohana 3.3] ( http://kohanaframework.org )
5- to provide Active Directory and LDAP authentication
6- with the [ Adldap2 ] ( http://adldap2.github.io ) library .
4+ A [ Kohana 3.3] ( http://kohanaframework.org ) module
5+ that wraps [ Adldap2 ] ( https://github.com/Adldap2/Adldap2 )
6+ to provide Active Directory and LDAP authentication .
77
88## 1. Install
99Copy the module to the ` kadldap ` directory in your ` MODPATH ` , or install with
1010[ Composer] ( https://getcomposer.org ) by adding the following to your
1111` composer.json ` file (to get the latest stable version):
1212
13- "samwilson/kohana_kadldap ": "*"
13+ "adldap2/adldap2-kohana ": "3. *"
1414
1515Then enable the module with ` Kohana::modules() ` (usually in ` bootstrap.php ` ).
1616
@@ -31,3 +31,7 @@ Use [Auth](http://kohanaframework.org/3.3/guide/auth) as usual. e.g.:
3131or:
3232
3333 Auth::instance()->logged_in('Security Group Name');
34+
35+ ## 4. Contribute
36+
37+ Please report all issues at https://github.com/Adldap2/Adldap2-Kohana/issues
Original file line number Diff line number Diff line change @@ -70,9 +70,11 @@ public function action_index()
7070$ username = Auth::instance ()->get_user ();
7171$ password = Auth::instance ()->password ($ username );
7272$ view ->kadldap ->authenticate ($ username , $ password );
73- $ view ->user = $ view ->kadldap ->users ()->find ($ username );
73+ $ view ->userinfo = $ view ->kadldap ->users ()
74+ ->find ($ username )
75+ ->getAttributes ();
7476} else {
75- $ view ->user = NULL ;
77+ $ view ->userinfo = NULL ;
7678}
7779}
7880
Original file line number Diff line number Diff line change @@ -91,20 +91,21 @@ public function logged_in($role = NULL)
9191
9292/**
9393 * Get list of all roles that the current user holds (i.e. LDAP groups
94- * of which they are a member.
95- *
96- * @uses adLDAPUsers::groups ()
97- * @return array An array of strings
94+ * of which they are a member) .
95+ *
96+ * @uses Adldap\Models\User::getGroups ()
97+ * @return string[]
9898 */
9999public function get_roles ()
100100{
101101$ username = $ this ->get_user ();
102102$ this ->kadldap ->authenticate ($ username , $ this ->password ($ username ));
103- return [];
104- var_dump ($ username , $ this ->kadldap ->users ());exit ();
105103$ user = $ this ->kadldap ->users ()->find ($ username );
106- $ groups = $ user ->getGroups ();
107- return $ groups ? $ groups : array ();
104+ $ groups = array ();
105+ foreach ($ user ->getGroups () as $ group ) {
106+ $ groups [$ group ->getCommonName ()] = $ group ->getCommonName ();
107+ }
108+ return $ groups ;
108109}
109110
110111}
Original file line number Diff line number Diff line change 11{
2- "name" : " samwilson/kohana_kadldap " ,
2+ "name" : " adldap2/adldap2-kohana " ,
33"type" : " kohana-module" ,
44"description" : " Module for AD/LDAP support in Kohana 3 (includes an Auth driver)." ,
55"license" : " MIT" ,
66"support" : {
7- "issues" : " https://github.com/samwilson/kohana_kadldap /issues" ,
7+ "issues" : " https://github.com/Adldap2/Adldap2-Kohana /issues" ,
88"forum" : " http://forum.kohanaframework.org" ,
99"irc" : " irc://irc.freenode.net/kohana" ,
10- "source" : " https://github.com/samwilson/kohana_kadldap "
10+ "source" : " https://github.com/Adldap2/Adldap2-Kohana "
1111},
1212"authors" : [
1313{
2525],
2626"require" : {
2727"kohana/auth" : " *" ,
28- "adldap2/adldap2" : " 5.0. *"
28+ "adldap2/adldap2" : " 5.*"
2929}
3030}
Original file line number Diff line number Diff line change 1212'domain_controllers ' => array (), // array('dc.example.com','dc1.example.com')
1313'account_suffix ' => '' , // '@example.com'
1414'base_dn ' => '' , // 'dc=example,dc=com',
15- 'ad_username ' => NULL ,
16- 'ad_password ' => NULL
15+ 'admin_username ' => NULL ,
16+ 'admin_password ' => NULL
1717)
1818);
You can’t perform that action at this time.
0 commit comments