Some thoughts on implementing simple object oriented security in ColdFusion. This entry is a result of great feedback I received from my previous entry.
What primary objects do we need?
There are two main objects that we need - User and SecurityService. There are a couple of other objects that will assist with the security functions and we will discuss them shortly.
The User object
First, we need a User object to represent the person who is logging in. The User object will be stored in the session scope.
The SecurityService object
The Security Service knows how to authenticate a person and create a User. We really only need one copy of the security service object so we will store it in the application scope.
In this example, the security service only has one function, getAuthenticatedUser(username,password), which returns an empty string if the authentication failes, otherwise returns a User object.
More ...