out.write("<!--\r\n Copyright 2004 The Apache Software Foundation\r\n\r\n Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n-->\r\n");
if (request.getParameter("logoff") == null) {
out.write("\r\n<html>\r\n<head>\r\n<title>Protected Page for Examples</title>\r\n</head>\r\n<body bgcolor=\"white\">\r\n\r\nYou are logged in as remote user <b>");
out.print(request.getRemoteUser());
out.write("</b>\r\nin session <b>");
out.print(session.getId());
out.write("</b><br><br>\r\n\r\n");
if (request.getUserPrincipal() != null) {
out.write("\r\n Your user principal name is\r\n <b>");
out.print(request.getUserPrincipal().getName());
out.write("</b><br><br>\r\n");
} else {
out.write("\r\n No user principal could be identified.<br><br>\r\n");
}
out.write("\r\n\r\n");
String role = request.getParameter("role");
if (role == null) {
role = "";
}
if (role.length() > 0) {
if (request.isUserInRole(role)) {
out.write("\r\n You have been granted role <b>");
out.print(role);
out.write("</b><br><br>\r\n");
} else {
out.write("\r\n You have <i>not</i> been granted role <b>");
out.print(role);
out.write("</b><br><br>\r\n");
}
}
out.write("\r\n\r\nTo check whether your username has been granted a particular role,\r\nenter it here:\r\n<form method=\"GET\" action='");
out.write("\">\r\n</form>\r\n<br><br>\r\n\r\nIf you have configured this app for form-based authentication, you can log\r\noff by clicking\r\n<a href='");
out.write("'>here</a>.\r\nThis should cause you to be returned to the logon page after the redirect\r\nthat is performed.\r\n\r\n</body>\r\n</html>\r\n");
return;
}
session.invalidate();
response.sendRedirect("index.jsp");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)) {
if (_jspx_out != null && _jspx_out.getBufferSize() != 0) {