List Info

Thread: Authentication in Mail Class




Authentication in Mail Class
user name
2007-02-02 07:57:35
Though this should be part of Zend_Auth, and not
Zend_Mail.... please see:
http://framework.zend.com/wiki/display/ZFDEV/Zend_Auth


Best,

Andriesss

Gavin Vess schreef:
> Looking at the code below, and the C code I wrote for
SASL 
> authentication in Postfix, I am not confident that
sufficient code 
> would be shared to justify the complexity of creating a
component to 
> export APIs to these different components, although I
can imagine a 
> "helper" class might contain a small amount
of common code, especially 
> if we created something vaguely like a fly-weight
version of the 
> "expect" language.  Regardless, my recent
experience with 
> Zend_Session* classes went the opposite direction, by
carefully 
> segmenting APIs and publishing them only for
consumption by the 
> intended classes, without polluting APIs with
irrelevant methods, 
> using superclasses with protected methods.
>
> If PHP had more robust syntactical methods for
isolating methods of a 
> class and exporting them only to selected classes, then
the situation 
> would be different.
>
> I trust Justin's working code is better than what we
have now 
> (nothing), and I personally will need this
functionality, so I am 
> hoping Justin will sign our CLA and contribute the
code.  There would 
> be plenty of opportunities to examine options and
alternative ways of 
> using this code 
>
> Cheers,
> Gavin
>
> Nico Edtinger wrote:
>> Maybe we could create a seperate class for auth
methods so we can use 
>> them with POP3 and IMAP too.
>>
>> nico
>>
>> [01.02.2007 23:10] Gavin Vess wrote:
>>
>>> Moving discussion to fw-formats list ...
>>>
>>> Hi Justin,
>>>
>>> Would you like to sign our CLA and create an
issue in our issue 
>>> tracker with this patch?
>>>
>>> http://framework.zend.com/wiki/displa
y/ZFPROP/Contributor+License+Agreement 
>>>
>>> http://framework.zend.com/issues/secure/Dashboard.jspa

>>>
>>> Thanks!
>>> Gavin
>>>
>>> Justin Hendrickson wrote:
>>>> I wrote this a few weeks back and it seems
to be working alright. 
>>>> It only supports AUTH LOGIN and AUTH PLAIN
though.
>>>>
>>>> <?php
>>>> require_once
'Zend/Mail/Transport/Smtp.php';
>>>>
>>>> class My_Zend_Mail_Transport_Smtp_Auth
extends 
>>>> Zend_Mail_Transport_Smtp {
>>>>      /**#+
>>>>      * Authentication types
>>>>      * var string
>>>>      */
>>>>     const LOGIN = 'LOGIN';
>>>>     const PLAIN = 'PLAIN';
>>>>     /**#-*/
>>>>      /**
>>>>      * param string $username
>>>>      * param string $password
>>>>      * param string $method
>>>>      */
>>>>     protected function
authenticate($username, $password, $method = 
>>>> self::PLAIN) {
>>>>         switch($method) {
>>>>             case self::LOGIN:
>>>>                
$this->authenticateLogin($username, $password);
>>>>             break;
>>>>              case self::PLAIN:
>>>>                
$this->authenticatePlain($username, $password);
>>>>             break;
>>>>         }
>>>>     }
>>>>      /**
>>>>      * param  string $username
>>>>      * param  string $password
>>>>      * throws
Zend_Mail_Transport_Exception
>>>>      */
>>>>     protected function
authenticateLogin($username, $password) {
>>>>         $this->_send('AUTH LOGIN');
>>>>          try {
>>>>             $this->_expect(334);
>>>>         }
catch(Zend_Mail_Transport_Exception $e) {
>>>>             if(substr($e->getMessage(),
0, 3) == 503) {
>>>>                 return;
>>>>             }
>>>>             throw $e;
>>>>         }
>>>>         
$this->_send(base64_encode($username));
>>>>         $this->_expect(334);
>>>>        
$this->_send(base64_encode($password));
>>>>         $this->_expect(235);
>>>>     }
>>>>      /**
>>>>      * param  string $username
>>>>      * param  string $password
>>>>      * throws
Zend_Mail_Transport_Exception
>>>>      */
>>>>     protected function
authenticatePlain($username, $password) {
>>>>         $this->_send('AUTH PLAIN');
>>>>          try {
>>>>             $this->_expect(334);
>>>>         }
catch(Zend_Mail_Transport_Exception $e) {
>>>>             if(substr($e->getMessage(),
0, 3) == 503) {
>>>>                 return;
>>>>             }
>>>>             throw $e;
>>>>         }
>>>>         
$this->_send(base64_encode(chr(0) . $username . chr(0) .

>>>> $password));
>>>>         $this->_expect(235);
>>>>     }
>>>>  }
>>>>
>>>> On 1/31/07, *Sanjay Aggarwal*
<sanjaye11online.com 
>>>> <mailto:sanjaye11online.com>>
wrote:
>>>>
>>>>     Right Now SMTP authentication is not
there in the mail class. Is
>>>>     there anyone who has implemented SMTP
authentication with Zend
>>>>     Framework any how? If so - do let me
know asap. That will be a
>>>>     great help for us.
>>>>          Regards,
>>>>     Sanjay Aggarwal
>>>>
>>>
>>> --Cheers,
>>> Gavin
>>>
>>> Which ZF List?
>>> =================
>>> Everything, except the topics below:
fw-generallists.zend.com
>>>
>>> Authorization, Authentication, ACL, Access
Control, Session Management
>>> fw-authlists.zend.com
>>>
>>> Tests, Caching, Configuration, Environment,
Logging
>>> fw-corelists.zend.com
>>>
>>> All things related to databases
>>> fw-dblists.zend.com
>>>
>>> Documentation, Translations, Wiki Manual /
Tutorials
>>> fw-docslists.zend.com
>>>
>>> Internationalization & Localization, Dates,
Calendar, Currency, Measure
>>> fw-i18nlists.zend.com
>>>
>>> Mail, MIME, PDF, Search, data formats (JSON,
...)
>>> fw-formatslists.zend.com
>>>
>>> MVC, Controller, Router, Views, Zend_Request*
>>> fw-mvclists.zend.com
>>>
>>> Community Servers/Services (shell account, PEAR
channel, Jabber)
>>> fw-serverlists.zend.com
>>> Web Services & Servers (HTTP, SOAP, Feeds,
XMLRPC, REST)
>>> fw-weblists.zend.com
>>>
>>>
>>> How to un/subscribe:  http://framework
.zend.com/wiki/x/GgE
>>>
>>
>>
>


-- 
Andries Seutens
http://andries.systray.be

i18n Locale Team is looking for your help.  Volunteers are
always welcome to contribute their feedback, bug fixes,
suggestions for enhancements and improvements, experimental
patches, and especially their ideas on the fw-i18n mail
list.

Are you enjoying the wiki manual?  They are frequently
updated and incubator documentation is also included!

Live manual: http:
//framework.zend.com/wiki/display/ZFDOCDEV
Incubator manual: http://f
ramework.zend.com/wiki/display/ZFDOC


Gecontroleerd op virussen door de JOJO Secure Gateway.

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )