auth:imap
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
auth:imap [2010-03-01 19:50] – 74.93.99.97 | auth:imap [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== IMAP/POP3 authentication | ||
- | |||
- | ===== What does it do? ===== | ||
- | |||
- | This authentication module, changes the password check for DokuWiki, from using the password file, | ||
- | to use an IMAP or pop3 server. | ||
- | It is build on the plain authentication backend, and works in the same way, | ||
- | with the only change that user passwords are checked against an IMAP/POP3 server. | ||
- | |||
- | NB: You still need to create you users in DokuWiki before they can log in. | ||
- | |||
- | |||
- | ===== Requirements ===== | ||
- | |||
- | * PHP IMAP (for Ubuntu use: aptitude install PHP5-IMAP) | ||
- | |||
- | ===== Install ===== | ||
- | |||
- | Copy the file [[http:// | ||
- | |||
- | |||
- | Or manually create the file by applying the following steps: \\ | ||
- | Copy the plain module: | ||
- | cp plain.class.php imap.class.php | ||
- | |||
- | Change the following lines in the file imap.class.php: | ||
- | |||
- | <code php> | ||
- | [...] | ||
- | class auth_imap extends auth_basic { | ||
- | [...] | ||
- | function auth_imap() { | ||
- | [...] | ||
- | |||
- | $this-> | ||
- | [...] | ||
- | | ||
- | | ||
- | if ($userinfo === false) return false; | ||
- | |||
- | $toReturn=false; | ||
- | |||
- | $imap_login = @imap_open(" | ||
- | if ($imap_login == false){ | ||
- | $toReturn = false; | ||
- | } | ||
- | else { | ||
- | $toReturn = true; | ||
- | imap_close($imap_login); | ||
- | } | ||
- | |||
- | return $toReturn; | ||
- | } | ||
- | [...] | ||
- | | ||
- | [...] | ||
- | $tmppass = time(); | ||
- | $pass = auth_cryptPassword($tmppass); | ||
- | [...] | ||
- | |||
- | </ | ||
- | |||
- | Now update the IMAP/pop3 server connection string. | ||
- | imap_open(" | ||
- | |||
- | See http:// | ||
- | |||
- | ===== Patch User Manager ===== | ||
- | As noted in [[auth: | ||
- | Fix it by either applying the patch on [[auth: | ||
- | |||
- | |||
- | ===== Comments ===== | ||
- | |||
- | **by mpc@20080825 :** | ||
- | |||
- | I guess we must also, as specified in pam auth , configure DokuWiki tu use imap auth by adding the following line to local.php: | ||
- | |||
- | $conf[' | ||
- | |||
- | Anyway, even if adding user in the configuration panel works fine, authentication does not works on my SME 7.3 server with this code, I had to modify the " | ||
- | $imap_login = @imap_open(" | ||
- | |||
- | of course, use this code this if your server supports imaps : | ||
- | $imap_login = @imap_open(" | ||
- | |||
- | Except a little bug (error message display when adding a user, but user added anyway), everything works great. | ||
- | |||
- | **mjm 20080913: | ||
- | I have modified the checkPass function to allow users to enter a full email address into the **Username** field during login. | ||
- | - looks for an underscore in the username. | ||
- | - sets $imapServer, | ||
- | - attempts to login to the appropriate IMAP (or POP3) server based on the email domain extracted from the username | ||
- | - fails if IMAP login fails; verifies or creates a local user if the IMAP login succeeds | ||
- | - finally, authenticates from conf/ | ||
- | < | ||
- | |||
- | #$userinfo = $this-> | ||
- | #if ($userinfo === false) return false; | ||
- | |||
- | $toReturn=false; | ||
- | |||
- | list( $imapUser, $imapDomain) = split(' | ||
- | if(!$imapDomain) $imapDomain = " | ||
- | $imapDomain= strtolower( $imapDomain); | ||
- | |||
- | | ||
- | case " | ||
- | $_groups | ||
- | $imapServer = " | ||
- | $imapLogin | ||
- | break; | ||
- | case " | ||
- | $_groups | ||
- | $imapServer = " | ||
- | $imapLogin | ||
- | break; | ||
- | case " | ||
- | unset ($imapServer); | ||
- | } | ||
- | |||
- | | ||
- | case true: | ||
- | $imap_login = @imap_open($imapServer, | ||
- | if ($imap_login == false){ | ||
- | $toReturn = false; | ||
- | } else { | ||
- | $toReturn = true; | ||
- | imap_close($imap_login); | ||
- | $userinfo = $this-> | ||
- | if ($userinfo === false) $newUser = $this-> | ||
- | $imapUser, | ||
- | } | ||
- | break; | ||
- | case false: | ||
- | $userinfo = $this-> | ||
- | if ($userinfo === false) { | ||
- | | ||
- | } else { | ||
- | | ||
- | } | ||
- | } | ||
- | | ||
- | }</ | ||
- | |||
auth/imap.1267469457.txt.gz · Last modified: 2010-03-01 19:50 by 74.93.99.97