|
28 | 28 | <%@ page import="password.pwm.util.java.JavaHelper" %>
|
29 | 29 | <%@ page import="java.util.Iterator" %>
|
30 | 30 | <%@ page import="password.pwm.util.java.JsonUtil" %>
|
| 31 | +<%@ page import="password.pwm.util.java.StringUtil" %> |
| 32 | +<%@ page import="password.pwm.bean.TokenDestinationItem" %> |
31 | 33 |
|
32 | 34 | <!DOCTYPE html>
|
33 | 35 | <%@ page language="java" session="true" isThreadSafe="true"
|
|
53 | 55 | <h1 id="page-content-title"><pwm:display key="Title_TokenLookup" bundle="Admin" displayIfMissing="true"/></h1>
|
54 | 56 | <%@ include file="fragment/admin-nav.jsp" %>
|
55 | 57 | <% final String tokenKey = tokenlookup_pwmRequest.readParameterAsString("token");%>
|
56 |
| - <% if (tokenKey != null && tokenKey.length() > 0) { %> |
| 58 | + <% |
| 59 | + TokenPayload tokenPayload = null; |
| 60 | + boolean tokenExpired = false; |
| 61 | + String lookupError = null; |
| 62 | + %> |
| 63 | + <% |
| 64 | + if ( !StringUtil.isEmpty( tokenKey ) ) |
| 65 | + { |
| 66 | + try |
| 67 | + { |
| 68 | + tokenPayload = tokenlookup_pwmRequest.getPwmApplication().getTokenService().retrieveTokenData(tokenlookup_pwmRequest.getSessionLabel(), tokenKey); |
| 69 | + } catch ( PwmOperationalException e ) |
| 70 | + { |
| 71 | + tokenExpired = e.getError() == PwmError.ERROR_TOKEN_EXPIRED; |
| 72 | + lookupError = e.getMessage(); |
| 73 | + } |
| 74 | + } |
| 75 | + %> |
| 76 | + <% if ( !StringUtil.isEmpty( tokenKey ) ) { %> |
57 | 77 | <table>
|
58 | 78 | <tr>
|
59 | 79 | <td colspan="10" class="title">Token Information</td>
|
60 | 80 | </tr>
|
61 |
| - <tr> |
62 |
| - <td class="key"> |
63 |
| - Key |
64 |
| - </td> |
65 |
| - <td> |
66 |
| - <%=tokenKey%> |
67 |
| - </td> |
68 |
| - </tr> |
69 |
| - <% |
70 |
| - TokenPayload tokenPayload = null; |
71 |
| - boolean tokenExpired = false; |
72 |
| - String lookupError = null; |
73 |
| - try { |
74 |
| - tokenPayload = tokenlookup_pwmRequest.getPwmApplication().getTokenService().retrieveTokenData(tokenlookup_pwmRequest.getSessionLabel(), tokenKey); |
75 |
| - } catch (PwmOperationalException e) { |
76 |
| - tokenExpired= e.getError() == PwmError.ERROR_TOKEN_EXPIRED; |
77 |
| - lookupError = e.getMessage(); |
78 |
| - } |
79 |
| - %> |
80 | 81 | <% if (tokenPayload != null) { %>
|
81 | 82 | <tr>
|
82 | 83 | <td class="key">
|
|
123 | 124 | Destination(s)
|
124 | 125 | </td>
|
125 | 126 | <td>
|
126 |
| - <%=JspUtility.friendlyWrite(pageContext, JsonUtil.serialize( tokenPayload.getDestination() ) )%> |
| 127 | + <% TokenDestinationItem tokenDestinationItem = tokenPayload.getDestination(); %> |
| 128 | + <% if ( tokenDestinationItem != null ) { %> |
| 129 | + <table> |
| 130 | + <tr> |
| 131 | + <td>Type</td><td><%=tokenDestinationItem.getType()%></td> |
| 132 | + </tr> |
| 133 | + <tr> |
| 134 | + <td>Destination</td><td><%=tokenDestinationItem.getDisplay()%></td> |
| 135 | + </tr> |
| 136 | + </table> |
| 137 | + <% } %> |
127 | 138 | </td>
|
128 | 139 | </tr>
|
129 | 140 | <tr>
|
|
145 | 156 | </table>
|
146 | 157 | </td>
|
147 | 158 | </tr>
|
148 |
| - <% } else { %> |
| 159 | + <% } %> |
| 160 | + <% if ( tokenPayload == null && lookupError == null ) { %> |
149 | 161 | <tr>
|
150 |
| - <td class="key"> |
151 |
| - Status |
152 |
| - </td> |
153 |
| - <td> |
154 |
| - <% if (tokenExpired) { %>Expired<% } else { %>Token Not Found<% } %> |
155 |
| - </td> |
| 162 | + <td>Status</td><td>Not Found</td> |
156 | 163 | </tr>
|
| 164 | + <% } %> |
| 165 | + <% if ( lookupError != null ) { %> |
157 | 166 | <tr>
|
158 | 167 | <td class="key">
|
159 | 168 | Lookup Error
|
|
164 | 173 | </tr>
|
165 | 174 | <% } %>
|
166 | 175 | </table>
|
167 |
| - <br/> |
168 | 176 | <% } %>
|
| 177 | + <br/> |
169 | 178 | <form id="tokenForm" action="<pwm:current-url/>" method="post">
|
170 | 179 | <textarea name="token" id="token" style="width: 580px; height: 150px"></textarea>
|
171 | 180 | <div class="buttonbar">
|
|
0 commit comments