Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
AppFuseSecurity
AppFuseSecurityMetho...




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseSecurityMethods


Difference between version 14 and version 6:

At line 1 removed 2 lines.
!!!This document is a work in progress, don't count on this actually working yet.
At line 5 changed 1 line.
Acegi Security is a security framework that is build using the techniques of the [Spring Framework|http://springframework.org] and is made to integrate easily into projects that utilize Spring, such as any application built on AppFuse 1.4 or newer (if your AppFuse app is older than 1.4 there is a tutorial for [migrating your app to use the Spring Framework|AppFuseSpringUpgrade]). The first level of Acegi integration into AppFuse is [authentication|AppFuseAuthentication] and authorization to access URI's based on user ''roles'', and this tutorial will assume you have already completed the migration from container managed security to use Acegi authentication. The next level is to grant or deny user access to methods of our service classes based on the user's role(s). Once you have completed this you may want to go on to adding [Access Control List authorization|AppFuseSecurityACL] for a more fine grained control.
Acegi Security is a security framework that is build using the techniques of the [Spring Framework|http://springframework.org] and is made to integrate easily into projects that utilize Spring, such as any application built on AppFuse 1.4 or newer (if your AppFuse app is older than 1.4 there is a tutorial for [migrating your app to use the Spring Framework|AppFuseSpringUpgrade]). The first level of Acegi integration into AppFuse is [authentication|AppFuseAuthentication] and authorization to access URI's based on user ''roles'', and this tutorial will assume you have already completed the migration from container managed security to use Acegi authentication. The next level is to grant or deny user access to methods of our service classes based on the user's role(s). Once you have completed this you may want to go on to [Part II|AppFuseSecurityMethods2] or add [Access Control List authorization|AppFuseSecurityACL] for a more fine grained control.
At line 29 added 1 line.
}}}
At line 32 changed 2 lines.
...
[{Java2HtmlPlugin
At line 115 changed 1 line.
}}}
}]
At line 117 changed 2 lines.
The second consideration for Actions is that public actions (any action that does not require the user to be logged on) can only access public methods on our manager beans and the resulting {{success}} page can only access public methods. When AppFuse comes out of the box the only action that needs to be modified is {{SignupAction}}. We will need to remove the code that ''automagically'' used to log in a user after signup. It would be possible to still do this, but it is fairly complicated and it's not really that important to me to make the user not have to log in right after creating his account. But the problem with leaving that code in is that is would cause one of the decorator pages to try and access UserManager.getUser() which is protected. This will cause an AccessDeniedException to be thrown since our user is not yet logged in. So remove this section of code from {{SignupAction}}:
{{{ // Set cookies for auto-magical login ;-)
The second consideration for Actions is that public actions (any action that does not require the user to be logged on) can only access public methods on our manager beans and the resulting {{success}} page can only access public methods. When AppFuse comes out of the box the only action that needs to be modified is {{SignupAction}}. We will need to remove the code that ''automagically'' used to log in a user after signup. It would be possible to still do this, but it is fairly complicated and it's not really that important to me to make the user not have to log in right after creating his account. But the problem with leaving that code in is that it would cause one of the decorator pages to try and access UserManager.getUser() which is protected. This will cause an AccessDeniedException to be thrown since our user is not yet logged in. So remove this section of code from {{SignupAction}}:
[{Java2HtmlPlugin
// Set cookies for auto-magical login ;-)
At line 121 changed 1 line.
loginCookie, request.getContextPath());}}}
loginCookie, request.getContextPath());
}]
At line 123 removed 1 line.
At line 199 added 2 lines.
Now that Acegi Method Invocation authorization is in our application and working we will need to make it grant access based on more than what roles a user has been given. For example we need to make sure a user with only the {{tomcat}} role can only use {{UserManager.getUser()}} to retreive his own account information, and {{UserManager.saveUser()}} only to update his profile. So that is our task in [Part II|AppFuseSecurityMethods2] of this tutorial.

Back to AppFuseSecurityMethods, or to the Page History.