Spring – How to use Spring security with Primefaces

primefacesspringspring-security

I have found so many examples but the problem is all of them are using JSP/JSF as view. The problem is they always use j_username as username input id and j_password as password id. What I found is these names are standard names. Primefaces doesn't allow me to give name to p:inputtext component. Do you have any solution?

Here is an example : http://krams915.blogspot.com/2012/01/spring-security-31-implement_13.html

Best Answer

j_username and j_password are only default values in Spring Security. You can customize these names as you expected. To do this, you set values for password-parameter and username-parameter as below:

<security:form-login login-page="/login.html" 
    default-target-url="/welcome.html"
    always-use-default-target="true" 
    authentication-failure-url="/login.html?error" 
    password-parameter="your_value" 
    username-parameter="your_value"/>

I'm using Spring Security 3.1. With another version, the configuration is possibly something like above.

Related Topic