https://community.jboss.org/thread/178998によると、RemeberMe は seam-security-3.1 に統合されていませんが、クラスは既に準備されています。
Seam2の既知の RememberMeは、次の 2 つのモードで利用できます。
幸いなことに、最初のモードの回避策を実装することは難しくありません。ログインに成功すると、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>
Cookie が利用可能かどうCookieBean
かを確認し、提供されたトークンをユーザー名にマップしてから、フォームにユーザー名を入力します。
@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;}
}