if (request.getParameter("logoff") != null) {
session.invalidate();
response.sendRedirect("index.jsp");
return;
}
%>
Protected Page for Examples
You are logged in as remote user
in session
if (request.getUserPrincipal() != null) {
%>
Your user principal name is
} 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
} else {
%>
You have not been granted 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.