-
Notifications
You must be signed in to change notification settings - Fork 759
Expand file tree
/
Copy pathapprove.jsp
More file actions
320 lines (288 loc) · 12.6 KB
/
approve.jsp
File metadata and controls
320 lines (288 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="org.springframework.security.core.AuthenticationException"%>
<%@ page import="org.springframework.security.oauth2.common.exceptions.UnapprovedClientAuthenticationException"%>
<%@ page import="org.springframework.security.web.WebAttributes"%>
<%@ taglib prefix="authz" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="o" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<spring:message code="approve.title" var="title"/>
<o:header title="${title}"/>
<o:topbar pageName="Approve" />
<div class="container main">
<% if (session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) != null && !(session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) instanceof UnapprovedClientAuthenticationException)) { %>
<div class="alert-message error">
<a href="#" class="close">×</a>
<p><strong><spring:message code="approve.error.not_granted"/></strong>
(<%= ((AuthenticationException) session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION)).getMessage() %>)
</p>
</div>
<% } %>
<c:remove scope="session" var="SPRING_SECURITY_LAST_EXCEPTION" />
<div class="well" style="text-align: center">
<h1><spring:message code="approve.required_for"/>
<c:choose>
<c:when test="${empty client.clientName}">
<em><c:out value="${client.clientId}" /></em>
</c:when>
<c:otherwise>
<em><c:out value="${client.clientName}" /></em>
</c:otherwise>
</c:choose>
</h1>
<form name="confirmationForm"
action="${ config.issuer }${ config.issuer.endsWith('/') ? '' : '/' }${ form_target } " method="post">
<div class="row">
<div class="span5 offset1 well-small" style="text-align: left">
<c:if test="${ client.dynamicallyRegistered }">
<c:choose>
<c:when test="${ gras }">
<!-- client is "generally recognized as safe, display a more muted block -->
<div>
<p class="alert alert-info">
<i class="icon-globe"></i>
<spring:message code="approve.dynamically_registered"/>
</p>
</div>
</c:when>
<c:otherwise>
<!-- client is dynamically registered -->
<div class="alert alert-block <c:out value="${ count eq 0 ? 'alert-error' : 'alert-warn' }" />">
<h4>
<i class="icon-globe"></i> <spring:message code="approve.caution.title"/>:
</h4>
<p>
<spring:message code="approve.dynamically_registered" arguments="${ client.createdAt }"/>
</p>
<p>
<c:choose>
<c:when test="${count == 0}">
<spring:message code="approve.caution.message.none" arguments="${count}"/>
</c:when>
<c:when test="${count == 1}">
<spring:message code="approve.caution.message.singular" arguments="${count}"/>
</c:when>
<c:otherwise>
<spring:message code="approve.caution.message.plural" arguments="${count}"/>
</c:otherwise>
</c:choose>
</p>
</div>
</c:otherwise>
</c:choose>
</c:if>
<c:if test="${ not empty client.logoUri }">
<ul class="thumbnails">
<li class="span5">
<a class="thumbnail" data-toggle="modal" data-target="#logoModal"><img src="api/clients/${ client.id }/logo" /></a>
</li>
</ul>
<!-- Modal -->
<div id="logoModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="logoModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="logoModalLabel">
<c:choose>
<c:when test="${empty client.clientName}">
<em><c:out value="${client.clientId}" /></em>
</c:when>
<c:otherwise>
<em><c:out value="${client.clientName}" /></em>
</c:otherwise>
</c:choose>
</h3>
</div>
<div class="modal-body">
<img src="api/clients/${ client.id }/logo" />
<c:if test="${ not empty client.clientUri }">
<a href="<c:out value="${ client.clientUri }" />"><c:out value="${ client.clientUri }" /></a>
</c:if>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
</c:if>
<c:if test="${ (not empty client.clientDescription) || (not empty client.clientUri) || (not empty client.policyUri) || (not empty client.tosUri) || (not empty contacts) }">
<div class="muted moreInformationContainer">
<c:out value="${client.clientDescription}" />
<c:if test="${ (not empty client.clientUri) || (not empty client.policyUri) || (not empty client.tosUri) || (not empty contacts) }">
<div id="toggleMoreInformation" style="cursor: pointer;">
<small><i class="icon-chevron-right"></i> <spring:message code="approve.more_information"/></small>
</div>
<div id="moreInformation" class="hide">
<ul>
<c:if test="${ not empty client.clientUri }">
<li><spring:message code="approve.home_page"/>: <a href="<c:out value="${ client.clientUri }" />"><c:out value="${ client.clientUri }" /></a></li>
</c:if>
<c:if test="${ not empty client.policyUri }">
<li><spring:message code="Policy"/>: <a href="<c:out value="${ client.policyUri }" />"><c:out value="${ client.policyUri }" /></a></li>
</c:if>
<c:if test="${ not empty client.tosUri }">
<li><spring:message code="approve.terms"/>: <a href="<c:out value="${ client.tosUri }" />"><c:out value="${ client.tosUri }" /></a></li>
</c:if>
<c:if test="${ (not empty contacts) }">
<li><spring:message code="approve.contacts"/>: <c:out value="${ contacts }" /></li>
</c:if>
</ul>
</div>
</c:if>
</div>
</c:if>
<div>
<c:choose>
<c:when test="${ empty client.redirectUris }">
<div class="alert alert-block alert-error">
<h4>
<i class="icon-info-sign"></i> <spring:message code="approve.warning"/>:
</h4>
<spring:message code="approve.no_redirect_uri"/>
<spring:message code="approve.redirect_uri" arguments="${ fn:escapeXml(redirect_uri) }"/>
</div>
</c:when>
<c:otherwise>
<spring:message code="approve.redirect_uri" arguments="${ fn:escapeXml(redirect_uri) }" />
</c:otherwise>
</c:choose>
</div>
<c:if test="${ client.subjectType == 'PAIRWISE' }">
<div class="alert alert-success">
<spring:message code="approve.pairwise"/>
</div>
</c:if>
</div>
<div class="span4">
<fieldset style="text-align: left" class="well">
<legend style="margin-bottom: 0;"><spring:message code="approve.access_to"/>:</legend>
<c:if test="${ empty client.scope }">
<div class="alert alert-block alert-error">
<h4>
<i class="icon-info-sign"></i> <spring:message code="approve.warning"/>:
</h4>
<p>
<spring:message code="approve.no_scopes"/>
</p>
</div>
</c:if>
<c:forEach var="scope" items="${ scopes }">
<label for="scope_${ fn:escapeXml(scope.value) }" class="checkbox">
<input type="checkbox" name="scope_${ fn:escapeXml(scope.value) }" id="scope_${ fn:escapeXml(scope.value) }" value="${ fn:escapeXml(scope.value) }" checked="checked">
<c:if test="${ not empty scope.icon }">
<i class="icon-${ fn:escapeXml(scope.icon) }"></i>
</c:if>
<c:choose>
<c:when test="${ not empty scope.description }">
<c:out value="${ scope.description }" />
</c:when>
<c:otherwise>
<c:out value="${ scope.value }" />
</c:otherwise>
</c:choose>
<c:if test="${ not empty claims[scope.value] }">
<span class="claim-tooltip" data-toggle="popover"
data-html="true"
data-placement="right"
data-trigger="hover"
data-title="These values will be sent:"
data-content="<div style="text-align: left;">
<ul>
<c:forEach var="claim" items="${ claims[scope.value] }">
<li>
<b><c:out value="${ claim.key }" /></b>:
<c:out value="${ claim.value }" />
</li>
</c:forEach>
</ul>
</div>
"
>
<i class="icon-question-sign"></i>
</span>
</c:if>
</label>
</c:forEach>
</fieldset>
<fieldset style="text-align: left" class="well">
<legend style="margin-bottom: 0;"><spring:message code="approve.remember.title"/>:</legend>
<label for="remember-forever" class="radio">
<input type="radio" name="remember" id="remember-forever" value="until-revoked" ${ !consent ? 'checked="checked"' : '' }>
<spring:message code="approve.remember.until_revoke"/>
</label>
<label for="remember-hour" class="radio">
<input type="radio" name="remember" id="remember-hour" value="one-hour">
<spring:message code="approve.remember.one_hour"/>
</label>
<label for="remember-not" class="radio">
<input type="radio" name="remember" id="remember-not" value="none" ${ consent ? 'checked="checked"' : '' }>
<spring:message code="approve.remember.next_time"/>
</label>
</fieldset>
</div>
</div>
<div class="row">
<h3>
<spring:message code="approve.do_authorize"/>
"<c:choose>
<c:when test="${empty client.clientName}">
<c:out value="${client.clientId}" />
</c:when>
<c:otherwise>
<c:out value="${client.clientName}" />
</c:otherwise>
</c:choose>"?
</h3>
<spring:message code="approve.label.authorize" var="authorize_label"/>
<spring:message code="approve.label.deny" var="deny_label"/>
<input id="user_oauth_approval" name="user_oauth_approval" value="true" type="hidden" />
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<input name="authorize" value="${authorize_label}" type="submit"
onclick="$('#user_oauth_approval').attr('value',true)" class="btn btn-success btn-large" />
<input name="deny" value="${deny_label}" type="submit" onclick="$('#user_oauth_approval').attr('value',false)"
class="btn btn-secondary btn-large" />
</div>
</form>
</div>
</div>
<script type="text/javascript">
<!--
$(document).ready(function() {
$('.claim-tooltip').popover();
$('.claim-tooltip').on('click', function(e) {
e.preventDefault();
$(this).popover('show');
});
$(document).on('click', '#toggleMoreInformation', function(event) {
event.preventDefault();
if ($('#moreInformation').is(':visible')) {
// hide it
$('.moreInformationContainer', this.el).removeClass('alert').removeClass('alert-info').addClass('muted');
$('#moreInformation').hide('fast');
$('#toggleMoreInformation i').attr('class', 'icon-chevron-right');
} else {
// show it
$('.moreInformationContainer', this.el).addClass('alert').addClass('alert-info').removeClass('muted');
$('#moreInformation').show('fast');
$('#toggleMoreInformation i').attr('class', 'icon-chevron-down');
}
});
var creationDate = "<c:out value="${ client.createdAt }" />";
var displayCreationDate = $.t('approve.dynamically-registered-unkown');
var hoverCreationDate = "";
if (creationDate != null && moment(creationDate).isValid()) {
creationDate = moment(creationDate);
if (moment().diff(creationDate, 'months') < 6) {
displayCreationDate = creationDate.fromNow();
} else {
displayCreationDate = "on " + creationDate.format("LL");
}
hoverCreationDate = creationDate.format("LLL");
}
$('#registrationTime').html(displayCreationDate);
$('#registrationTime').attr('title', hoverCreationDate);
});
//-->
</script>
<o:footer/>