<?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: Implementing Simple Object Oriented Security in ColdFusion</title>
	<atom:link href="http://blog.stannard.net.au/2006/11/14/implementing-simple-object-oriented-security-in-coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stannard.net.au/2006/11/14/implementing-simple-object-oriented-security-in-coldfusion/</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/2006/11/14/implementing-simple-object-oriented-security-in-coldfusion/comment-page-1/#comment-132</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Wed, 10 Jan 2007 12:58:13 +0000</pubDate>
		<guid isPermaLink="false">#comment-132</guid>
		<description>Just a couple of exta notes from CFCDev:

From Aaron:

&quot;By putting the user in the session scope you would not have to pass in the session to any of the methods in your security class, right?

Example:
&lt;cfset session.siteuser =
application.siteUser.getAuthenticatedUser(username,password) /&gt;

I kind of thought that Kevan&#039;s idea of passing in everything in the session scope was a little strange, but perhaps I am not getting it.&quot;

Yes, I think Aaron is right.

From Peter:

&quot;Well, I&#039;d probably do something more like:
&lt;cfset session.SiteUser =
attributes.UserService.getAuthenticatedUser(Username,Password)&gt;

This assumes you are in some kind of cfc that has has the UserService injected using ColdSpring or LightWire via constructor or setter injection.&quot;

Many thanks, Peter.</description>
		<content:encoded><![CDATA[<p>Just a couple of exta notes from CFCDev:</p>
<p>From Aaron:</p>
<p>&quot;By putting the user in the session scope you would not have to pass in the session to any of the methods in your security class, right?</p>
<p>Example:<br />
&lt;cfset session.siteuser =<br />
application.siteUser.getAuthenticatedUser(username,password) /&gt;</p>
<p>I kind of thought that Kevan&#8217;s idea of passing in everything in the session scope was a little strange, but perhaps I am not getting it.&quot;</p>
<p>Yes, I think Aaron is right.</p>
<p>From Peter:</p>
<p>&quot;Well, I&#8217;d probably do something more like:<br />
&lt;cfset session.SiteUser =<br />
attributes.UserService.getAuthenticatedUser(Username,Password)&gt;</p>
<p>This assumes you are in some kind of cfc that has has the UserService injected using ColdSpring or LightWire via constructor or setter injection.&quot;</p>
<p>Many thanks, Peter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Bell</title>
		<link>http://blog.stannard.net.au/2006/11/14/implementing-simple-object-oriented-security-in-coldfusion/comment-page-1/#comment-131</link>
		<dc:creator>Peter Bell</dc:creator>
		<pubDate>Wed, 10 Jan 2007 04:53:51 +0000</pubDate>
		<guid isPermaLink="false">#comment-131</guid>
		<description>Hi Kevan,

I would put the changePassword() into the SiteUser, but I&#039;d actually delegate to something other than the service layer. I think it is very easy to get into &quot;OO Procedural coding&quot; where we have class libraries (service classes) and fairly dumb TOs. Because of that, I try to limit service classes to handling collections of business objects or acting as a factory to return the business objects based on a query. Once I have a SiteUser, I&#039;ll either let it do the work, on in the case of authentication I&#039;ll compose it of SiteUserSecurity.cfc or something similar (still playing with exact naming and functions) to handle that rather than running everything through a service method.</description>
		<content:encoded><![CDATA[<p>Hi Kevan,</p>
<p>I would put the changePassword() into the SiteUser, but I&#8217;d actually delegate to something other than the service layer. I think it is very easy to get into &quot;OO Procedural coding&quot; where we have class libraries (service classes) and fairly dumb TOs. Because of that, I try to limit service classes to handling collections of business objects or acting as a factory to return the business objects based on a query. Once I have a SiteUser, I&#8217;ll either let it do the work, on in the case of authentication I&#8217;ll compose it of SiteUserSecurity.cfc or something similar (still playing with exact naming and functions) to handle that rather than running everything through a service method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2006/11/14/implementing-simple-object-oriented-security-in-coldfusion/comment-page-1/#comment-130</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Wed, 10 Jan 2007 01:19:15 +0000</pubDate>
		<guid isPermaLink="false">#comment-130</guid>
		<description>Hi Phillip, the idea is to try and hide away how the authentication is actually performed, and we keep any database specific stuff (such as any references to table field names) inside your &#039;Data Access Objects&#039; and nowhere else. If you did want to perform some kind of conditional login, then you could either have a couple of different login functions or pass an extra parameter in the login function. For example, you could have different function such as loginUsernamePassword(session,username,password) which authenticates as above, and loginMemberCode(session,code) which performs authentication by looking at a different field in the database.

Hi Peter, thanks very much for your comments. I have also copied some of your notes from CFCDev:

&quot;I actually think some of those could go into a session based SiteUser object - I typically put operations into a service method only if they relate to a collection of objects or if an object instance doesn&#039;t yet exist (in which case the service method or the DI engine has to handle it - one of the two). Because that seems to me object specific, for know I put such code into the service method rather than a generalized factory. For example, I&#039;d put changePassword() and hasRole() into the SiteUser business object. Not always the right approach, but not a bad generalized solution.&quot;

Would it make sense to have a reference to the security service stored inside the SiteUser object, and have a call on siteUser.chancePassword() (for example) delegated to the securityService.changePassword()?

Hi Aaron, for your encryption you could perhaps use the built in ColdFusion hash() function. I have not used this before, but it may be just what you need. Alternatively try a search for &#039;one way encryption coldfusion&#039; and you should get some links. See the following link for some info on encryption and the hash() function: http://www.adobe.com/devnet/server_archive/articles/understanding_encrypt.html</description>
		<content:encoded><![CDATA[<p>Hi Phillip, the idea is to try and hide away how the authentication is actually performed, and we keep any database specific stuff (such as any references to table field names) inside your &#8216;Data Access Objects&#8217; and nowhere else. If you did want to perform some kind of conditional login, then you could either have a couple of different login functions or pass an extra parameter in the login function. For example, you could have different function such as loginUsernamePassword(session,username,password) which authenticates as above, and loginMemberCode(session,code) which performs authentication by looking at a different field in the database.</p>
<p>Hi Peter, thanks very much for your comments. I have also copied some of your notes from CFCDev:</p>
<p>&quot;I actually think some of those could go into a session based SiteUser object &#8211; I typically put operations into a service method only if they relate to a collection of objects or if an object instance doesn&#8217;t yet exist (in which case the service method or the DI engine has to handle it &#8211; one of the two). Because that seems to me object specific, for know I put such code into the service method rather than a generalized factory. For example, I&#8217;d put changePassword() and hasRole() into the SiteUser business object. Not always the right approach, but not a bad generalized solution.&quot;</p>
<p>Would it make sense to have a reference to the security service stored inside the SiteUser object, and have a call on siteUser.chancePassword() (for example) delegated to the securityService.changePassword()?</p>
<p>Hi Aaron, for your encryption you could perhaps use the built in ColdFusion hash() function. I have not used this before, but it may be just what you need. Alternatively try a search for &#8216;one way encryption coldfusion&#8217; and you should get some links. See the following link for some info on encryption and the hash() function: <a href="http://www.adobe.com/devnet/server_archive/articles/understanding_encrypt.html" rel="nofollow">http://www.adobe.com/devnet/server_archive/articles/understanding_encrypt.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Roberson</title>
		<link>http://blog.stannard.net.au/2006/11/14/implementing-simple-object-oriented-security-in-coldfusion/comment-page-1/#comment-129</link>
		<dc:creator>Aaron Roberson</dc:creator>
		<pubDate>Tue, 09 Jan 2007 14:38:29 +0000</pubDate>
		<guid isPermaLink="false">#comment-129</guid>
		<description>Where could I get an encryption component? I did not find anything on cfczone.org.</description>
		<content:encoded><![CDATA[<p>Where could I get an encryption component? I did not find anything on cfczone.org.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Bell</title>
		<link>http://blog.stannard.net.au/2006/11/14/implementing-simple-object-oriented-security-in-coldfusion/comment-page-1/#comment-128</link>
		<dc:creator>Peter Bell</dc:creator>
		<pubDate>Tue, 09 Jan 2007 13:38:03 +0000</pubDate>
		<guid isPermaLink="false">#comment-128</guid>
		<description>Since you asked for comments on the list - here are some thoughts!

Firstly, I&#039;d use ColdSpring (or LightWire when it&#039;s ready for primetime :-&gt;) to handle injecting this into any controllers that require it rather than just sticking it in application scope. Maybe not a big issue for this one component, but it&#039;ll become more important over time.

Secondly, it is fundamentally users that are being authenticated (at least in this case), so I&#039;d give the responsibility for this to the UserService and then just delegate the responsibility to UserAuthenticationService - I think that&#039;d be cleaner.

I&#039;d also take a more OO as opposed to service level approach. A lot of the features you put into a service singleton I&#039;d put into the a SiteUser.cfc business object that would probably be stored in session scope (assuming you were using sessions) - again delegating to a UserSecurity or UserAuthentication object as it&#039;s generally a good idea to put responsibilities into the business object rather than a service layer where possible.

Just some thoughts which I guarantee to be worth exactly what you paid for them :-&gt;</description>
		<content:encoded><![CDATA[<p>Since you asked for comments on the list &#8211; here are some thoughts!</p>
<p>Firstly, I&#8217;d use ColdSpring (or LightWire when it&#8217;s ready for primetime :-&gt;) to handle injecting this into any controllers that require it rather than just sticking it in application scope. Maybe not a big issue for this one component, but it&#8217;ll become more important over time.</p>
<p>Secondly, it is fundamentally users that are being authenticated (at least in this case), so I&#8217;d give the responsibility for this to the UserService and then just delegate the responsibility to UserAuthenticationService &#8211; I think that&#8217;d be cleaner.</p>
<p>I&#8217;d also take a more OO as opposed to service level approach. A lot of the features you put into a service singleton I&#8217;d put into the a SiteUser.cfc business object that would probably be stored in session scope (assuming you were using sessions) &#8211; again delegating to a UserSecurity or UserAuthentication object as it&#8217;s generally a good idea to put responsibilities into the business object rather than a service layer where possible.</p>
<p>Just some thoughts which I guarantee to be worth exactly what you paid for them :-&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phillip Senn</title>
		<link>http://blog.stannard.net.au/2006/11/14/implementing-simple-object-oriented-security-in-coldfusion/comment-page-1/#comment-127</link>
		<dc:creator>Phillip Senn</dc:creator>
		<pubDate>Tue, 09 Jan 2007 13:36:56 +0000</pubDate>
		<guid isPermaLink="false">#comment-127</guid>
		<description>So why not have function login simply pass the query and let the calling program decide which columns it wants to use (provided the .RecordCount GT 0)?</description>
		<content:encoded><![CDATA[<p>So why not have function login simply pass the query and let the calling program decide which columns it wants to use (provided the .RecordCount GT 0)?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

