Saturday, February 19, 2011

Typical Security in roo

Roo provides a basic Spring Security setup out of the box.
roo> security setup
But what if you want the typical security features like user registration and password changing etc.?

There is a project underway to provide this. The Typical security add-on for roo facilitates the generation of some typical security features.

The author introduced it to the community here: http://forum.springsource.org/showthread.php?t=100534 but basically, the following will be all that you need to do to gain all the typical security features.
roo> Typicalsecurity setup --controllerPackage ~.web --entityPackage ~.domain
There are some minor bugs in the current build (0.1.2.BUILD). After you run the setup, you will need to
roo> focus --class ~.domain.UserModel
~.domain.UserModel roo> finder add findUserModelsByEmailAddress
~.domain.UserModel roo> finder add findUserModelsByActivationKeyAndEmailAddress
~.domain.UserModel roo> field date --type java.util.Date --fieldName activationDate
~.domain.UserModel roo> focus --class ~.domain.UserRoleModel
~.domain.UserRoleModel roo> finder add findUserRoleModelsByUserEntry
and you will need to comment out the Autowired annotation for SimpleMailMessage in SignUpController.java and ForgotPasswordController.java
//@Autowired
private transient SimpleMailMessage simpleMailMessage;

I will be keeping a close eye on this project. I sure hope it finds its way into the standard roo distribution.

No comments:

Post a Comment