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