View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

{zone-data:component-name}
Zend_Session_ValidatorRemoteAddr
{zone-data}

{zone-data:proposer-list}
[FractalizeR@yandex.ru|mailto:FractalizeR@yandex.ru]
{zone-data}

{zone-data:revision}
1.0 - 13 November 2007: Initial release
{zone-data}

{zone-data:overview}
Zend_Session_ValidatorRemoteAddr is almost a copy of Zend_Session_ValidatorHttpUserAgent with an exception, that it validates IP address of session starter
{zone-data}

{zone-data:references}
* [Component Page on SourceForge.net|http://zfsvalidators.sourceforge.net/]
{zone-data}

{zone-data:requirements}
Nothing special requried to use this component

* This component *will not* save any data using Zend_Cache or the filesystem. All transient data *will be* saved using Zend_Session.
{zone-data}

{zone-data:dependencies}
* Zend_Session
{zone-data}

{zone-data:operation}
The component is instantized by executing Zend_Sesion::registerValidator(new Zend_Session_Validator_RemoteAddr());
{zone-data}

{zone-data:milestones}
The component is so simple, that it does not require any milestones
{zone-data}

{zone-data:class-list}
* Zend_Session_ValidatorRemoteAddr
{zone-data}

{zone-data:use-cases}
||UC-01||You want to bind session to client IP address to improve security
{zone-data}

{zone-data:skeletons}
{code}
try {
Zend_Session::start(); //Starting session
} catch (Zend_Session_Exception $e) {
//Unable to create session. Possibly, session validation failed
//(For example, UserAgent or IP address is changed on client. We can get reason from $e->getMessage())
}

//Doing something and finding out that there is a need to remember this session data
if($needToKeepThisSession) {
Zend_Sesion::registerValidator(new Zend_Session_Validator_HttpUserAgent()); //Registering first validator
Zend_Sesion::registerValidator(new Zend_Session_Validator_RemoteAddr()); //Registering second validator
Zend_Session::rememberMe();
}{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>