%
if (request.getParameter("logoff") != null) {
session.invalidate();
response.sendRedirect("index.jsp");
return;
}
%>
Protected Page for Examples
You are logged in as remote user
<%= util.HTMLFilter.filter(request.getRemoteUser()) %>
in session <%= session.getId() %>
<%
if (request.getUserPrincipal() != null) {
%>
Your user principal name is
<%= util.HTMLFilter.filter(request.getUserPrincipal().getName()) %>
<%
} else {
%>
No user principal could be identified.
<%
}
%>
<%
String role = request.getParameter("role");
if (role == null)
role = "";
if (role.length() > 0) {
if (request.isUserInRole(role)) {
%>
You have been granted role
<%= util.HTMLFilter.filter(role) %>
<%
} else {
%>
You have not been granted role
<%= util.HTMLFilter.filter(role) %>
<%
}
}
%>
To check whether your username has been granted a particular role,
enter it here:
If you have configured this app for form-based authentication, you can log
off by clicking
here.
This should cause you to be returned to the logon page after the redirect
that is performed.