根据https://community.jboss.org/thread/178998 RemeberMe不被整合seam-security-3.1,但是该类已经是prepared。
从Seam2已知了rememberMe是在两种模式下可用的:
幸运的是,为第一种模式实施解决方法并不困难。登录成功后,您可以设置cookie:
FacesContext.getCurrentInstance().addResponseCookie("cookieName", "myToken", null);
然后确保自己CookieBean
登录
<ui:fragment rendered="#{cookieBean.dummy}"/>
<h:form id="fLogin">
<h:inputText value="#{credentials.username}"/>
<h:inputSecret value="#{credentials.password}" redisplay="true"/>
<h:commandButton value="LOGIN" action="#{identity.login}"/>
</h:form>
之前调用在你CookieBean
,你可以检查你的cookie可用,地图所提供的令牌给用户名,然后填写表单中的用户名。
@Named @SessionScoped
public class CookieBean implements Serializable
{
@Inject Credentials credentials;
@PostConstruct
public void init()
{
Map<String, Object> cookies = FacesContext.getCurrentInstance().
getExternalContext().getRequestCookieMap();
// Check if you cookie is available
// Do some stuff with your cookie
// Cookie cookie = (Cookie) cookies.get("cookieName");
credentials.setUsername("myUserName");
}
public boolean getDummy() {return false;}
}
你的错误是什么?会发生什么让你知道它不起作用? –
没有数据写入令牌表 – RLuceac
您是否使用过该功能Justin? @JustinSatyr – RLuceac