I try to implement the /ibm_security_logout
logic in a JSF project.
There are some requirements about the way which I should use for logging out.
It should conform this form:
<FORM METHOD=POST ACTION="<%=request.getContextPath()%>/ibm_security_logout"
NAME="LogoutForm">
<INPUT TYPE="HIDDEN" NAME="logoutExitPage"
VALUE="/../weblogin/logout?dest=/myapp/goodbye.jsp">
<INPUT TYPE="submit" NAME="logout" VALUE="Logout">
</FORM>
Both cases must be there.
<%=request.getContextPath()%>/ibm_security_logout"
VALUE="/../weblogin/logout?dest=/myapp/goodbye.jsp">
How can I realise it with commanlink?
<h:commandLink value="Log Out" action="#{sessionController.logout}" />
How should it look like in the bean method??
public void logout() throws IOException {
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.invalidateSession();
ec.redirect("/../weblogin/logout?dest=/myapp/goodbye.jsp");
}
EDIT
#{request.contextPath}
= localhost:9080/MyProject
Login Page = localhost:9080/weblogin/login?webapp=/MyProject (Login Page is managed via) an extern Framework
Logout is also managed via an extern framework. Therefore the URL must conform this VALUE="/../weblogin/logout?dest=/weblogin/login?webapp=/MyProject.
I tried it with the code below. But it did not work.
<form id="logout" action="#{request.contextPath}/ibm_security_logout"
method="post">
<input type="hidden" name="logoutExitPage"
value="/../weblogin/logout?dest=/weblogin/login?webapp=/MyProject">
<a href="#" onclick="document.getElementById('logout').submit()">Logout_NEU</a>
</form>