How-to logout from ADF Security
Posted
by frank.nimphius
on Oracle Blogs
See other posts from Oracle Blogs
or by frank.nimphius
Published on Tue, 04 Jan 2011 21:29:11 +0000
Indexed on
2011/01/04
21:57 UTC
Read the original article
Hit count: 383
ADF Security
|ADFm
ADF Security configures an authentication servlet, AuthenticationServlet, in the web.xml file that also provides a logout functionality. Developers can invoke the logout by a redirect performed from an action method in a managed bean as shown next
public String onLogout() {
FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx =
fctx.getExternalContext();
String url = ectx.getRequestContextPath()
+
"/adfAuthentication?logout=true&end_url=/faces/Home.jspx";
try {
ectx.redirect(url);
} catch (IOException e) {
e.printStackTrace();
}
fctx.responseComplete();
return null;
}
To use this functionality in your application, change the Home.jspx reference to a public page of yours that the user is redirected to after successful logout.
Note that for a successful logout, authentication should be through form based authentication. Basic authentication is known as browser sign-on and re-authenticates users after the logout redirect. Basic authentication is confusing to many developers for this reason.
© Oracle Blogs or respective owner