@capedcoder--
FW/1 on RIAForge: http://fw1.riaforge.org/
FW/1 on github: http://github.com/seancorfield/fw1
FW/1 on Google Groups: http://groups.google.com/group/framework-one
In general, I think going with meta data should save you a decent
amount of coding, but in this case I'm not sure it really does -- you
still need to type in the roles and the extra attribute, which isn't
less code to maintain than just calling a method from your base
controller to secure a given controller action. You DO get the
benefit of automatic documentation and a tight idiom, so those might
be good enough reasons in your case.
Be sure to cache the meta data in the init() of your base controller,
so you're not incurring the overhead of that every time you want to
look it up.
I find that I now always use a baseController for all of my
controllers -- it's quite slim in most cases, but it has been nice to
be able to have some utility methods always available (and I grab a
lookup of my services in the init, so I can reference them in my
controller methods as simply "services.myService.myMethod(myArgs)"
instead of calling out to the bean factory every time), so remembering
to do the super.before(rc) doesn't seem too onerous.
As an aside, I've been thinking about what a "plugin" system for FW/1
would look like lately, and this might be an interesting candidate --
basically a way to, by convention, have your machinery called as part
of the before()/init() of a controller call. I've been building a
bunch of "small" apps lately, and all of them have basically the same
user/permissions setup and some basic utilities for doing things like
bootstrapping various versions of the app as it goes through
deployments -- but I end up copying/pasting a lot of that into the
various nooks and crannies of FW/1 instead of having it all as a nice
bundle of code. Subsystems don't quite work for this kind of thing
from my initial noodling, though.
- Nathan Dintenfass
On Mon, Apr 9, 2012 at 6:27 PM, @CapedCoder <cfx...@gmail.com> wrote:
- Nathan Dintenfass
On Mon, Apr 9, 2012 at 6:27 PM, @CapedCoder <> wrote:
> Hi All,
>
> I'm looking for some feedback on implementing security in my application.
>
> What I was thinking of doing is adding an annotation of permissions="myrole"
> to those methods I want to secure in my controllers. I would then extend
> each of my controllers that have "secure" methods with a base controller in
> which the before() method would inspect the metadata for the method in the
> cfc that I am calling e.g. startManageArticles. If the particular method
> has a "permissions" property it would compare that property against their
> array of permissions and redirect them to another page if it does not
> exist. The only caveat I have found is that if I want my target controller
> to have a before() function, I have to call super.before(rc) in order to
> enforce the security. I have tested this and it does work, but I'm not sure
> if it is good practice.
>
> I'm interested in hearing how other folks have addressed this common problem
> and whether or not this may be a good way to solve this problem.
>
> Thanks!
>
> Seth
> @capedcoder
>
>
>
> --
> FW/1 on RIAForge: http://fw1.riaforge.org/
>
> FW/1 on github: http://github.com/seancorfield/fw1
>
> FW/1 on Google Groups: http://groups.google.com/group/framework-one
- Nathan Dintenfass
On Mon, Apr 9, 2012 at 6:27 PM, @CapedCoder <> wrote:
> Hi All,
>
> I'm looking for some feedback on implementing security in my application.
>
> What I was thinking of doing is adding an annotation of permissions="myrole"
> to those methods I want to secure in my controllers. I would then extend
> each of my controllers that have "secure" methods with a base controller in
> which the before() method would inspect the metadata for the method in the
> cfc that I am calling e.g. startManageArticles. If the particular method
> has a "permissions" property it would compare that property against their
> array of permissions and redirect them to another page if it does not
> exist. The only caveat I have found is that if I want my target controller
> to have a before() function, I have to call super.before(rc) in order to
> enforce the security. I have tested this and it does work, but I'm not sure
> if it is good practice.
>
> I'm interested in hearing how other folks have addressed this common problem
> and whether or not this may be a good way to solve this problem.
>
> Thanks!
>
> Seth
> @capedcoder
>
>
>
> --
> FW/1 on RIAForge: http://fw1.riaforge.org/
>
> FW/1 on github: http://github.com/seancorfield/fw1
>
> FW/1 on Google Groups: http://groups.google.com/group/framework-one
- Nathan Dintenfass
On Mon, Apr 9, 2012 at 6:27 PM, @CapedCoder <> wrote:
> Hi All,
>
> I'm looking for some feedback on implementing security in my application.
>
> What I was thinking of doing is adding an annotation of permissions="myrole"
> to those methods I want to secure in my controllers. I would then extend
> each of my controllers that have "secure" methods with a base controller in
> which the before() method would inspect the metadata for the method in the
> cfc that I am calling e.g. startManageArticles. If the particular method
> has a "permissions" property it would compare that property against their
> array of permissions and redirect them to another page if it does not
> exist. The only caveat I have found is that if I want my target controller
> to have a before() function, I have to call super.before(rc) in order to
> enforce the security. I have tested this and it does work, but I'm not sure
> if it is good practice.
>
> I'm interested in hearing how other folks have addressed this common problem
> and whether or not this may be a good way to solve this problem.
>
> Thanks!
>
> Seth
> @capedcoder
>
>
>
> --
> FW/1 on RIAForge: http://fw1.riaforge.org/
>
> FW/1 on github: http://github.com/seancorfield/fw1
>
> FW/1 on Google Groups: http://groups.google.com/group/framework-one
- Nathan Dintenfass
On Mon, Apr 9, 2012 at 6:27 PM, @CapedCoder wrote:
> Hi All,
>
> I'm looking for some feedback on implementing security in my application.
>
> What I was thinking of doing is adding an annotation of permissions="myrole"
> to those methods I want to secure in my controllers. I would then extend
> each of my controllers that have "secure" methods with a base controller in
> which the before() method would inspect the metadata for the method in the
> cfc that I am calling e.g. startManageArticles. If the particular method
> has a "permissions" property it would compare that property against their
> array of permissions and redirect them to another page if it does not
> exist. The only caveat I have found is that if I want my target controller
> to have a before() function, I have to call super.before(rc) in order to
> enforce the security. I have tested this and it does work, but I'm not sure
> if it is good practice.
>
> I'm interested in hearing how other folks have addressed this common problem
> and whether or not this may be a good way to solve this problem.
>
> Thanks!
>
> Seth
> @capedcoder
>
>
>
> --
> FW/1 on RIAForge: http://fw1.riaforge.org/
>
> FW/1 on github: http://github.com/seancorfield/fw1
>
> FW/1 on Google Groups: http://groups.google.com/group/framework-one
- Nathan Dintenfass
--
--
--