| 1 | <!-- | 
|---|
| 2 |  Licensed to the Apache Software Foundation (ASF) under one or more | 
|---|
| 3 |   contributor license agreements.  See the NOTICE file distributed with | 
|---|
| 4 |   this work for additional information regarding copyright ownership. | 
|---|
| 5 |   The ASF licenses this file to You under the Apache License, Version 2.0 | 
|---|
| 6 |   (the "License"); you may not use this file except in compliance with | 
|---|
| 7 |   the License.  You may obtain a copy of the License at | 
|---|
| 8 |  | 
|---|
| 9 |       http://www.apache.org/licenses/LICENSE-2.0 | 
|---|
| 10 |  | 
|---|
| 11 |   Unless required by applicable law or agreed to in writing, software | 
|---|
| 12 |   distributed under the License is distributed on an "AS IS" BASIS, | 
|---|
| 13 |   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|---|
| 14 |   See the License for the specific language governing permissions and | 
|---|
| 15 |   limitations under the License. | 
|---|
| 16 | --> | 
|---|
| 17 | <% | 
|---|
| 18 |   if (request.getParameter("logoff") != null) { | 
|---|
| 19 |     session.invalidate(); | 
|---|
| 20 |     response.sendRedirect("index.jsp"); | 
|---|
| 21 |     return; | 
|---|
| 22 |   } | 
|---|
| 23 | %> | 
|---|
| 24 | <html> | 
|---|
| 25 | <head> | 
|---|
| 26 | <title>Protected Page for Examples</title> | 
|---|
| 27 | </head> | 
|---|
| 28 | <body bgcolor="white"> | 
|---|
| 29 |  | 
|---|
| 30 | You are logged in as remote user | 
|---|
| 31 | <b><%= util.HTMLFilter.filter(request.getRemoteUser()) %></b> | 
|---|
| 32 | in session <b><%= session.getId() %></b><br><br> | 
|---|
| 33 |  | 
|---|
| 34 | <% | 
|---|
| 35 |   if (request.getUserPrincipal() != null) { | 
|---|
| 36 | %> | 
|---|
| 37 |     Your user principal name is | 
|---|
| 38 |     <b><%= util.HTMLFilter.filter(request.getUserPrincipal().getName()) %></b> | 
|---|
| 39 |     <br><br> | 
|---|
| 40 | <% | 
|---|
| 41 |   } else { | 
|---|
| 42 | %> | 
|---|
| 43 |     No user principal could be identified.<br><br> | 
|---|
| 44 | <% | 
|---|
| 45 |   } | 
|---|
| 46 | %> | 
|---|
| 47 |  | 
|---|
| 48 | <% | 
|---|
| 49 |   String role = request.getParameter("role"); | 
|---|
| 50 |   if (role == null) | 
|---|
| 51 |     role = ""; | 
|---|
| 52 |   if (role.length() > 0) { | 
|---|
| 53 |     if (request.isUserInRole(role)) { | 
|---|
| 54 | %> | 
|---|
| 55 |       You have been granted role | 
|---|
| 56 |       <b><%= util.HTMLFilter.filter(role) %></b><br><br> | 
|---|
| 57 | <% | 
|---|
| 58 |     } else { | 
|---|
| 59 | %> | 
|---|
| 60 |       You have <i>not</i> been granted role | 
|---|
| 61 |       <b><%= util.HTMLFilter.filter(role) %></b><br><br> | 
|---|
| 62 | <% | 
|---|
| 63 |     } | 
|---|
| 64 |   } | 
|---|
| 65 | %> | 
|---|
| 66 |  | 
|---|
| 67 | To check whether your username has been granted a particular role, | 
|---|
| 68 | enter it here: | 
|---|
| 69 | <form method="GET" action='<%= response.encodeURL("index.jsp") %>'> | 
|---|
| 70 | <input type="text" name="role" value="<%= util.HTMLFilter.filter(role) %>"> | 
|---|
| 71 | </form> | 
|---|
| 72 | <br><br> | 
|---|
| 73 |  | 
|---|
| 74 | If you have configured this app for form-based authentication, you can log | 
|---|
| 75 | off by clicking | 
|---|
| 76 | <a href='<%= response.encodeURL("index.jsp?logoff=true") %>'>here</a>. | 
|---|
| 77 | This should cause you to be returned to the logon page after the redirect | 
|---|
| 78 | that is performed. | 
|---|
| 79 |  | 
|---|
| 80 | </body> | 
|---|
| 81 | </html> | 
|---|