
|
If you were logged in you would be able to see more operations.
|
|
|
|
The attached patch improves password encoding capabilities so that the same password encoder object is used by both ACEGI at authentication time and AppFuse Actions/Controllers at user sign up / modification time. This will make it possible for AppFuse to use any other password encoding techniques featuring higher security than simple MessageDigests.
Also, the responsibility for performing password encoding is moved from the Actions/Controllers to the services layer (UserManager). UserManager gets the "daoAuthenticationProvider" dependency-injected, which lets UserManager perform the necessary password encoding operations because:
* DaoAuthenticationProvider contains references to both PasswordEncoder and SaltSource.
* If the user does not define a password encoder bean in security.xml, DaoAuthenticationProvider will use a PlaintextPasswordEncoder, this is, no encryption. And DaoAuthenticationProvider.getPasswordEncoder() will return to us that PlaintextPasswordEncoder object. This is exactly the behaviour we wanted (no "passwordEncoder" bean = no password encryption).
* With this approach, if the user defines a SaltSource and passes it to the DaoAuthenticationProvider, we will also use it to parameterize password encryption at user sign up or modification time. If we didn't, ACEGI would never correctly match passwords at sign in time in this scenario.
A new method is declared in UserManager for saving users, called also "saveUser" (so that it benefits from the transaction declarations in applicationContext-service.xml), but it receives two parameters: "user", and a boolean called "passwordChanged". The old method (which only receives one parameter) is still there, but in theory it could be removed (unless you want to avoid problems with any users who could have already created code calling this method in their apps)...
This is what the patch does:
DATA:
* Remove both ENCRYPT_PASSWORD and ENC_ALGORITHM from Constants.
SERVICE:
* Remove the StringUtil class
* Modify UserManager to add the saveUser(User, boolean) interface.
* Modify UserManagerImpl to add the saveUser(User, boolean) implementation.
* Add reference to daoAuthenticationProvider for userManager in applicationContext-service.xml
* Add beans "daoAuthenticationProvider" and "userCache" in service/src/test/resources/applicationContext-resources.xml
WEB-COMMON
* Modify StartupListener not to check "passwordEncoded", and not putting into config neither the ENCRYPT_PASSWORD nor the ENC_ALGORITHM values.
* Add web/common/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Modify StartupListenerTest to use the new applicationContext-resources.xml
* Remove comment from security.xml telling that "passwordEncoder" has to be there for StartupListener to read it
WEB-APPFUSE-JSF
* Modify SignupForm and UserForm in appfuse-jsf to remove the password encryption code and use the new saveUser method in UserManager.
* Add web/jsf/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Add a reference to web/jsf/src/test/resources/applicationContext-resources.xml from BasePageTestCase in appfuse-jsf
WEB-APPFUSE-SPRING
* Modify SignupController and UserFormController in appfuse-spring to remove the password encryption code and use the new saveUser method in UserManager.
* Add web/spring/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Add a reference to web/spring/src/test/resources/applicationContext-resources.xml from BaseControllerTestCase in appfuse-spring
WEB-APPFUSE-STRUTS
* Modify SignupAction and UserAction in appfuse-struts to remove the password encryption code and use the new saveUser method in UserManager.
* Add web/struts/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Add a reference to web/struts/src/test/resources/applicationContext-resources.xml from BaseActionTestCase in appfuse-struts
WEB-APPFUSE-TAPESTRY
* Modify SignupForm and UserForm in appfuse-tapestry to remove the password encryption code and use the new saveUser method in UserManager.
* Add web/tapestry/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Add a reference to web/tapestry/src/test/resources/applicationContext-resources.xml from BasePageTestCase in appfuse-tapestry
|
|
Description
|
The attached patch improves password encoding capabilities so that the same password encoder object is used by both ACEGI at authentication time and AppFuse Actions/Controllers at user sign up / modification time. This will make it possible for AppFuse to use any other password encoding techniques featuring higher security than simple MessageDigests.
Also, the responsibility for performing password encoding is moved from the Actions/Controllers to the services layer (UserManager). UserManager gets the "daoAuthenticationProvider" dependency-injected, which lets UserManager perform the necessary password encoding operations because:
* DaoAuthenticationProvider contains references to both PasswordEncoder and SaltSource.
* If the user does not define a password encoder bean in security.xml, DaoAuthenticationProvider will use a PlaintextPasswordEncoder, this is, no encryption. And DaoAuthenticationProvider.getPasswordEncoder() will return to us that PlaintextPasswordEncoder object. This is exactly the behaviour we wanted (no "passwordEncoder" bean = no password encryption).
* With this approach, if the user defines a SaltSource and passes it to the DaoAuthenticationProvider, we will also use it to parameterize password encryption at user sign up or modification time. If we didn't, ACEGI would never correctly match passwords at sign in time in this scenario.
A new method is declared in UserManager for saving users, called also "saveUser" (so that it benefits from the transaction declarations in applicationContext-service.xml), but it receives two parameters: "user", and a boolean called "passwordChanged". The old method (which only receives one parameter) is still there, but in theory it could be removed (unless you want to avoid problems with any users who could have already created code calling this method in their apps)...
This is what the patch does:
DATA:
* Remove both ENCRYPT_PASSWORD and ENC_ALGORITHM from Constants.
SERVICE:
* Remove the StringUtil class
* Modify UserManager to add the saveUser(User, boolean) interface.
* Modify UserManagerImpl to add the saveUser(User, boolean) implementation.
* Add reference to daoAuthenticationProvider for userManager in applicationContext-service.xml
* Add beans "daoAuthenticationProvider" and "userCache" in service/src/test/resources/applicationContext-resources.xml
WEB-COMMON
* Modify StartupListener not to check "passwordEncoded", and not putting into config neither the ENCRYPT_PASSWORD nor the ENC_ALGORITHM values.
* Add web/common/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Modify StartupListenerTest to use the new applicationContext-resources.xml
* Remove comment from security.xml telling that "passwordEncoder" has to be there for StartupListener to read it
WEB-APPFUSE-JSF
* Modify SignupForm and UserForm in appfuse-jsf to remove the password encryption code and use the new saveUser method in UserManager.
* Add web/jsf/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Add a reference to web/jsf/src/test/resources/applicationContext-resources.xml from BasePageTestCase in appfuse-jsf
WEB-APPFUSE-SPRING
* Modify SignupController and UserFormController in appfuse-spring to remove the password encryption code and use the new saveUser method in UserManager.
* Add web/spring/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Add a reference to web/spring/src/test/resources/applicationContext-resources.xml from BaseControllerTestCase in appfuse-spring
WEB-APPFUSE-STRUTS
* Modify SignupAction and UserAction in appfuse-struts to remove the password encryption code and use the new saveUser method in UserManager.
* Add web/struts/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Add a reference to web/struts/src/test/resources/applicationContext-resources.xml from BaseActionTestCase in appfuse-struts
WEB-APPFUSE-TAPESTRY
* Modify SignupForm and UserForm in appfuse-tapestry to remove the password encryption code and use the new saveUser method in UserManager.
* Add web/tapestry/src/test/resources/applicationContext-resources.xml (for declaring daoAuthenticationProvider)
* Add a reference to web/tapestry/src/test/resources/applicationContext-resources.xml from BasePageTestCase in appfuse-tapestry
|
Show » |
Sort Order:
|
One problem I see with this vs. the existing implementation is that it looks difficult to turn off password encryption.