如何在 Primefaces 中使用 Spring 安全性 [英] How to use Spring security with Primefaces
问题描述
我发现了很多例子,但问题是它们都使用 JSP/JSF
作为视图.问题是他们总是使用 j_username
作为用户名输入 id 和 j_password
作为密码 id.我发现这些名称是标准名称.Primefaces 不允许我为 p:inputtext
组件命名.你有什么解决办法吗?
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?
这是一个例子:http://krams915.blogspot.com/2012/01/spring-security-31-implement_13.html
推荐答案
j_username
和 j_password
只是 Spring Security 中的默认值.您可以按预期自定义这些名称.为此,您可以为 password-parameter
和 username-parameter
设置如下值:
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"/>
我使用的是 Spring Security 3.1.使用另一个版本,配置可能与上面类似.
I'm using Spring Security 3.1. With another version, the configuration is possibly something like above.
这篇关于如何在 Primefaces 中使用 Spring 安全性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!