<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Securing AMFPHP 1.9 via Authentication</title>
	<atom:link href="http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/</link>
	<description>RIA, embedded programming, what else!</description>
	<lastBuildDate>Fri, 09 Jul 2010 15:43:56 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: merdj</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-475</link>
		<dc:creator>merdj</dc:creator>
		<pubDate>Tue, 15 Jun 2010 18:06:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-475</guid>
		<description>Hello Josh,

if it is ok with you, kindly post a working sample of this authentication thing? I could hardly, and sorry for that. I am just beginning with AMFPHP.

thanks for caring.</description>
		<content:encoded><![CDATA[<p>Hello Josh,</p>
<p>if it is ok with you, kindly post a working sample of this authentication thing? I could hardly, and sorry for that. I am just beginning with AMFPHP.</p>
<p>thanks for caring.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-470</link>
		<dc:creator>Joshua</dc:creator>
		<pubDate>Wed, 09 Jun 2010 14:54:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-470</guid>
		<description>Enrique,
  You&#039;d want to create a login function.  The normal workflow would be to pass a username/password from Flex to your login function.  This function would validate the username / password.  (Database lookup, LDAP, etc).

*If* it&#039;s a valid username/password, you&#039;d then call Authenticate::login($username,$roles) which provides the needed authentication for the subsequent AMFPHP calls.

AMFPHP stores the authentication info in session vars so normal session rules apply.

Josh</description>
		<content:encoded><![CDATA[<p>Enrique,<br />
  You&#8217;d want to create a login function.  The normal workflow would be to pass a username/password from Flex to your login function.  This function would validate the username / password.  (Database lookup, LDAP, etc).</p>
<p>*If* it&#8217;s a valid username/password, you&#8217;d then call Authenticate::login($username,$roles) which provides the needed authentication for the subsequent AMFPHP calls.</p>
<p>AMFPHP stores the authentication info in session vars so normal session rules apply.</p>
<p>Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Enrique</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-467</link>
		<dc:creator>Enrique</dc:creator>
		<pubDate>Mon, 24 May 2010 20:00:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-467</guid>
		<description>I&#039;m having troubles understanding it too...
Can you post a full example? (I mean, the AS3 and PHP side).

Where and when must we call Authenticate::login($username,$roles);?

And what happens if the user doesn&#039;t have cookies enabled?

Thanks!!</description>
		<content:encoded><![CDATA[<p>I&#8217;m having troubles understanding it too&#8230;<br />
Can you post a full example? (I mean, the AS3 and PHP side).</p>
<p>Where and when must we call Authenticate::login($username,$roles);?</p>
<p>And what happens if the user doesn&#8217;t have cookies enabled?</p>
<p>Thanks!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Decidirse entre Zend AMF, AMFPHP, WebORB, &#8230; &#124; Blog de Daniel Zegarra</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-463</link>
		<dc:creator>Decidirse entre Zend AMF, AMFPHP, WebORB, &#8230; &#124; Blog de Daniel Zegarra</dc:creator>
		<pubDate>Fri, 21 May 2010 12:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-463</guid>
		<description>[...] y Zend AMF lo hace como objetos) y basaba casi toda la implementacion de seguridad en el metodo beforeFilter de cada clase/servicio.    [...]</description>
		<content:encoded><![CDATA[<p>[...] y Zend AMF lo hace como objetos) y basaba casi toda la implementacion de seguridad en el metodo beforeFilter de cada clase/servicio.    [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kevin</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-242</link>
		<dc:creator>kevin</dc:creator>
		<pubDate>Thu, 15 Jan 2009 07:01:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-242</guid>
		<description>Hi,

I&#039;m having a bit of trouble understanding how to implement this and was hoping you could point me in the right direction..

I defined a class as follows but when I call the getData method from Flex, it returns fine without any authentication occuring:

memberName) ? Authenticate::isUserInRole($this-&gt;$memberName) : true;
	}
	
	var $SecuredClassRoles = &quot;admin&quot;;
	var $GetDataRoles = &quot;admin&quot;;
	
	public function SecuredClass() {
		
	}
	
	public function GetData() {
		
		return &quot;You Got In&quot;;
	
	} 

}

?&gt;

Also, I noticed you posted on Wade&#039;s site asking whether this is the &#039;best&#039; way to implement auth - did he give you an answer or have you an updated opinion?

cheers!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;m having a bit of trouble understanding how to implement this and was hoping you could point me in the right direction..</p>
<p>I defined a class as follows but when I call the getData method from Flex, it returns fine without any authentication occuring:</p>
<p>memberName) ? Authenticate::isUserInRole($this-&gt;$memberName) : true;<br />
	}</p>
<p>	var $SecuredClassRoles = &#8220;admin&#8221;;<br />
	var $GetDataRoles = &#8220;admin&#8221;;</p>
<p>	public function SecuredClass() {</p>
<p>	}</p>
<p>	public function GetData() {</p>
<p>		return &#8220;You Got In&#8221;;</p>
<p>	} </p>
<p>}</p>
<p>?&gt;</p>
<p>Also, I noticed you posted on Wade&#8217;s site asking whether this is the &#8216;best&#8217; way to implement auth &#8211; did he give you an answer or have you an updated opinion?</p>
<p>cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-226</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Sun, 09 Nov 2008 03:47:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-226</guid>
		<description>what about the json.php file? How do you secure that? So someone can&#039;t run www.mysite/json.php/PHPclass.function/var1/var2/var3 ???</description>
		<content:encoded><![CDATA[<p>what about the json.php file? How do you secure that? So someone can&#8217;t run <a href="http://www.mysite/json.php/PHPclass.function/var1/var2/var3" rel="nofollow">http://www.mysite/json.php/PHPclass.function/var1/var2/var3</a> ???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-205</link>
		<dc:creator>Joshua</dc:creator>
		<pubDate>Fri, 19 Sep 2008 03:43:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-205</guid>
		<description>cooljack

Make a call to a php script that validates the login credentials.  If successful you could call

Authenticate::login($usrer,$roles);

and to destroy the session (logout)

Authenticate::logout();

Let me know if you need further assistance.</description>
		<content:encoded><![CDATA[<p>cooljack</p>
<p>Make a call to a php script that validates the login credentials.  If successful you could call</p>
<p>Authenticate::login($usrer,$roles);</p>
<p>and to destroy the session (logout)</p>
<p>Authenticate::logout();</p>
<p>Let me know if you need further assistance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cooljackd</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-203</link>
		<dc:creator>cooljackd</dc:creator>
		<pubDate>Sat, 13 Sep 2008 02:59:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-203</guid>
		<description>hi how would you call the service from flash to validate the Authentication.</description>
		<content:encoded><![CDATA[<p>hi how would you call the service from flash to validate the Authentication.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-200</link>
		<dc:creator>Joshua</dc:creator>
		<pubDate>Mon, 08 Sep 2008 12:22:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-200</guid>
		<description>Ben,
  Take a look at line 120 of AMFPHP&#039;s core/shared/app/BasicActions.php.  Here&#039;s the code
  
  
if ($allow === &#039;__amfphp_error&#039; &#124;&#124; $allow === false) {
	$ex = new MessageException(E_USER_ERROR, &quot;Method access blocked by beforeFilter in &quot; . $className . &quot; class&quot;, __FILE__, __LINE__, &quot;AMFPHP_AUTHENTICATE_ERROR&quot;);
	MessageException::throwException($amfbody, $ex);
	return false;
} 


You could do something along the lines of

if ($allow !== true)
{

   if($allow === &#039;__amfphp_error&#039; &#124;&#124; $allow === false)
	$ex = new MessageException(E_USER_ERROR, &quot;Method access blocked by beforeFilter in &quot; . $className . &quot; class&quot;, __FILE__, __LINE__, &quot;AMFPHP_AUTHENTICATE_ERROR&quot;);
    else
	$ex = new MessageException(E_USER_ERROR, $allow . &quot; &quot; . $className . &quot; class&quot;, __FILE__, __LINE__, &quot;AMFPHP_AUTHENTICATE_ERROR&quot;);
    
	MessageException::throwException($amfbody, $ex);
	return false;     
}

Where you return the error string (instead of false) from your before filter.  If you *do* return false from your before filter, the legacy AMFPHP error is thrown.

Hope that helps!!</description>
		<content:encoded><![CDATA[<p>Ben,<br />
  Take a look at line 120 of AMFPHP&#8217;s core/shared/app/BasicActions.php.  Here&#8217;s the code</p>
<p>if ($allow === &#8216;__amfphp_error&#8217; || $allow === false) {<br />
	$ex = new MessageException(E_USER_ERROR, &#8220;Method access blocked by beforeFilter in &#8221; . $className . &#8221; class&#8221;, __FILE__, __LINE__, &#8220;AMFPHP_AUTHENTICATE_ERROR&#8221;);<br />
	MessageException::throwException($amfbody, $ex);<br />
	return false;<br />
} </p>
<p>You could do something along the lines of</p>
<p>if ($allow !== true)<br />
{</p>
<p>   if($allow === &#8216;__amfphp_error&#8217; || $allow === false)<br />
	$ex = new MessageException(E_USER_ERROR, &#8220;Method access blocked by beforeFilter in &#8221; . $className . &#8221; class&#8221;, __FILE__, __LINE__, &#8220;AMFPHP_AUTHENTICATE_ERROR&#8221;);<br />
    else<br />
	$ex = new MessageException(E_USER_ERROR, $allow . &#8221; &#8221; . $className . &#8221; class&#8221;, __FILE__, __LINE__, &#8220;AMFPHP_AUTHENTICATE_ERROR&#8221;);</p>
<p>	MessageException::throwException($amfbody, $ex);<br />
	return false;<br />
}</p>
<p>Where you return the error string (instead of false) from your before filter.  If you *do* return false from your before filter, the legacy AMFPHP error is thrown.</p>
<p>Hope that helps!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Throop</title>
		<link>http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-198</link>
		<dc:creator>Ben Throop</dc:creator>
		<pubDate>Wed, 03 Sep 2008 22:05:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.joshuaostrom.com/2008/06/03/securing-amfphp-19-via-authentication/#comment-198</guid>
		<description>Good post. Do you know if it&#039;s possible to return different values when beforeFilter fails? I want one failing state to return a message that says &quot;This happened&quot; and the other failing state to return a message that says &quot;That happened&quot;. The problem is that AMFPHP is the one sending the fault and it always comes back as:

faultCode	String	AMFPHP_AUTHENTICATE_ERROR
faultDetail	String	/amfphp/core/shared/app/BasicActions.php on line 121
faultString	String	Method access blocked by beforeFilter in PublisherService class

Any ideas?</description>
		<content:encoded><![CDATA[<p>Good post. Do you know if it&#8217;s possible to return different values when beforeFilter fails? I want one failing state to return a message that says &#8220;This happened&#8221; and the other failing state to return a message that says &#8220;That happened&#8221;. The problem is that AMFPHP is the one sending the fault and it always comes back as:</p>
<p>faultCode	String	AMFPHP_AUTHENTICATE_ERROR<br />
faultDetail	String	/amfphp/core/shared/app/BasicActions.php on line 121<br />
faultString	String	Method access blocked by beforeFilter in PublisherService class</p>
<p>Any ideas?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
