<?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: Simple Object Oriented Security in ColdFusion (Version 2)</title>
	<atom:link href="http://blog.stannard.net.au/2007/01/11/simple-object-oriented-security-in-coldfusion-version-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stannard.net.au/2007/01/11/simple-object-oriented-security-in-coldfusion-version-2/</link>
	<description></description>
	<lastBuildDate>Sun, 08 Jan 2012 15:53:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2007/01/11/simple-object-oriented-security-in-coldfusion-version-2/comment-page-1/#comment-106</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Wed, 23 Sep 2009 19:18:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-106</guid>
		<description>Hi Stephen, thanks.</description>
		<content:encoded><![CDATA[<p>Hi Stephen, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Weyrick</title>
		<link>http://blog.stannard.net.au/2007/01/11/simple-object-oriented-security-in-coldfusion-version-2/comment-page-1/#comment-105</link>
		<dc:creator>Stephen Weyrick</dc:creator>
		<pubDate>Wed, 23 Sep 2009 18:57:16 +0000</pubDate>
		<guid isPermaLink="false">#comment-105</guid>
		<description>Hi Kevan-

Thanks for writing this post.  I am currently trying to implement something similar at work, and I was having a tough time visualizing how exactly all of the objects should be laid out.  This was a nice reference for me since I have only begun taking the plunge into OOP world. :)</description>
		<content:encoded><![CDATA[<p>Hi Kevan-</p>
<p>Thanks for writing this post.  I am currently trying to implement something similar at work, and I was having a tough time visualizing how exactly all of the objects should be laid out.  This was a nice reference for me since I have only begun taking the plunge into OOP world. <img src='http://blog.stannard.net.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2007/01/11/simple-object-oriented-security-in-coldfusion-version-2/comment-page-1/#comment-104</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Fri, 05 Jun 2009 16:46:18 +0000</pubDate>
		<guid isPermaLink="false">#comment-104</guid>
		<description>Hi Göran

It might still be a good idea to still keep all of your separate UserDAO, CompanyDAO etc, but to have them all extend your TransferDAO. This way they inherit all of the base TransferDAO functionality, but also allow you to add custom functionality specific to that object.

For example, your CompanyDAO may have a function delete() that might do some extra work first before asking the parent TransferDAO to delete the company record. 

Another thought; you might like to rename your TransferDAO to BaseDAO to keep it even more generic.</description>
		<content:encoded><![CDATA[<p>Hi Göran</p>
<p>It might still be a good idea to still keep all of your separate UserDAO, CompanyDAO etc, but to have them all extend your TransferDAO. This way they inherit all of the base TransferDAO functionality, but also allow you to add custom functionality specific to that object.</p>
<p>For example, your CompanyDAO may have a function delete() that might do some extra work first before asking the parent TransferDAO to delete the company record. </p>
<p>Another thought; you might like to rename your TransferDAO to BaseDAO to keep it even more generic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Göran</title>
		<link>http://blog.stannard.net.au/2007/01/11/simple-object-oriented-security-in-coldfusion-version-2/comment-page-1/#comment-103</link>
		<dc:creator>Göran</dc:creator>
		<pubDate>Thu, 04 Jun 2009 15:48:20 +0000</pubDate>
		<guid isPermaLink="false">#comment-103</guid>
		<description>Yes I found that it´s mentioned in the API Reference that it returns an empty object.  

Yes! To check for the userid works great! I was first thinking of some kind of RecordCount solution, but this is better. 

To avoid having transfer methods everywhere I did a generic TransferDAO that wraps the transfer functions I am currently using, instead of having UserDAO, CompanyDAO etc.  I also try to have generic but descriptive names for the methods such as list, delete, create and of course readByPropertyMap (maybe quite generic anyway). Now I have only one class to deal with for Transfer things, and generic data access metodh names, that I don´t have to change if I change ORM.</description>
		<content:encoded><![CDATA[<p>Yes I found that it´s mentioned in the API Reference that it returns an empty object.  </p>
<p>Yes! To check for the userid works great! I was first thinking of some kind of RecordCount solution, but this is better. </p>
<p>To avoid having transfer methods everywhere I did a generic TransferDAO that wraps the transfer functions I am currently using, instead of having UserDAO, CompanyDAO etc.  I also try to have generic but descriptive names for the methods such as list, delete, create and of course readByPropertyMap (maybe quite generic anyway). Now I have only one class to deal with for Transfer things, and generic data access metodh names, that I don´t have to change if I change ORM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2007/01/11/simple-object-oriented-security-in-coldfusion-version-2/comment-page-1/#comment-102</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Thu, 04 Jun 2009 01:09:34 +0000</pubDate>
		<guid isPermaLink="false">#comment-102</guid>
		<description>Hi Göran

Searching on both userEmail and userPassword sounds good to me.

I understand that if Transfer can&#039;t find a matching record then it returns an empty User object. You might like to check the userId on the object returned from the userDAO to see if the user was found.

For example, in the SecurityService object:

&lt;cffunction name=&quot;getAuthenticatedUser&quot; output=&quot;false&quot;&gt;
    &lt;cfargument name=&quot;username&quot; type=&quot;string&quot; required=&quot;true&quot;&gt;
    &lt;cfargument name=&quot;password&quot; type=&quot;string&quot; required=&quot;true&quot;&gt;
    &lt;cfset var user = variables.userDAO.readByUsernameAndPassword(arguments.username,arguments.password)&gt;
    &lt;cfif user.getUserId() gt 0&gt;
        &lt;cfreturn user&gt;
    &lt;cfelse&gt;
        &lt;cfreturn &quot;&quot;&gt;
    &lt;/cfif&gt;
&lt;/cffunction&gt;</description>
		<content:encoded><![CDATA[<p>Hi Göran</p>
<p>Searching on both userEmail and userPassword sounds good to me.</p>
<p>I understand that if Transfer can&#8217;t find a matching record then it returns an empty User object. You might like to check the userId on the object returned from the userDAO to see if the user was found.</p>
<p>For example, in the SecurityService object:</p>
<p>&lt;cffunction name=&quot;getAuthenticatedUser&quot; output=&quot;false&quot;&gt;<br />
    &lt;cfargument name=&quot;username&quot; type=&quot;string&quot; required=&quot;true&quot;&gt;<br />
    &lt;cfargument name=&quot;password&quot; type=&quot;string&quot; required=&quot;true&quot;&gt;<br />
    &lt;cfset var user = variables.userDAO.readByUsernameAndPassword(arguments.username,arguments.password)&gt;<br />
    &lt;cfif user.getUserId() gt 0&gt;<br />
        &lt;cfreturn user&gt;<br />
    &lt;cfelse&gt;<br />
        &lt;cfreturn &quot;&quot;&gt;<br />
    &lt;/cfif&gt;<br />
&lt;/cffunction&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Göran</title>
		<link>http://blog.stannard.net.au/2007/01/11/simple-object-oriented-security-in-coldfusion-version-2/comment-page-1/#comment-101</link>
		<dc:creator>Göran</dc:creator>
		<pubDate>Wed, 03 Jun 2009 13:44:01 +0000</pubDate>
		<guid isPermaLink="false">#comment-101</guid>
		<description>Hi,
I have tried to implement your OO security as part of my process to learn OO. 
I use no framework just Transfer ORM and cfc:s. 

First I created a UserDAO that gets the user by transfers readByPropertyMap. 

I put the UserDAO and the SecurityService in the Appplication.cfc OnApplicationStart method as singeltons (application scope). 

In the SecurityService I pass both the username (in my case e-mail) and password to the UserDAO (therefore the readByPropertyMap). I don´t know if it´s best to search only in the user field or both the user and password field, It felt better to restrict the query as much as possible.

Before my modification of the SecurityService I tested it with your set up, and found that if you don´t fill in anything in the login fields you still get validated, and a user object is created (Probably empty. Dump just shows an empty transfer object). So I added LEN(arguments.password) to check the length in the SecurityService and don´t return a user object if it has no length. Maybe a Transfer thing, how it creates objects.

Because I use Transfer and no framework I think I don´t have the need for dependency injection in this simple case.

Great example anyway!</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I have tried to implement your OO security as part of my process to learn OO.<br />
I use no framework just Transfer ORM and cfc:s. </p>
<p>First I created a UserDAO that gets the user by transfers readByPropertyMap. </p>
<p>I put the UserDAO and the SecurityService in the Appplication.cfc OnApplicationStart method as singeltons (application scope). </p>
<p>In the SecurityService I pass both the username (in my case e-mail) and password to the UserDAO (therefore the readByPropertyMap). I don´t know if it´s best to search only in the user field or both the user and password field, It felt better to restrict the query as much as possible.</p>
<p>Before my modification of the SecurityService I tested it with your set up, and found that if you don´t fill in anything in the login fields you still get validated, and a user object is created (Probably empty. Dump just shows an empty transfer object). So I added LEN(arguments.password) to check the length in the SecurityService and don´t return a user object if it has no length. Maybe a Transfer thing, how it creates objects.</p>
<p>Because I use Transfer and no framework I think I don´t have the need for dependency injection in this simple case.</p>
<p>Great example anyway!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

