Revision 59615
Added by Katerina Iatropoulou over 3 years ago
registerService.jsp | ||
---|---|---|
17 | 17 |
<title>OpenAIRE - Register</title> |
18 | 18 |
<script src="./js/jquery.js"></script> |
19 | 19 |
<script src="./js/uikit.js"></script> |
20 |
<script src="./js/validation.js"></script> |
|
21 | 20 |
<script src="./js/uikit-icons-max.js"></script> |
22 | 21 |
<link rel="stylesheet" style="text/css" href="./css/theme.css"> |
23 | 22 |
<link rel="stylesheet" style="text/css" href="./css/custom.css"> |
... | ... | |
95 | 94 |
<!-- CENTER SIDE --> |
96 | 95 |
<div class="uk-width-2-3@l uk-width-2-3@m"> |
97 | 96 |
<h2 class="uk-h2 uk-margin-small-bottom">Add a new service</h2> |
98 |
<%--<div class="uk-text-meta uk-margin-large-bottom">Use the same credentials for all our services</div>--%> |
|
99 |
<h4 class="uk-h4">Please provide the basic information on your new service</h4> |
|
100 | 97 |
<div class="middle-box text-center loginscreen animated fadeInDown "> |
101 | 98 |
<div class="k-width-1-1@m uk-width-1-1@s uk-text-center"> |
102 | 99 |
<!-- REGISTER FORM --> |
103 | 100 |
<div id="registerForm"> |
104 |
<form action="registerService" method="POST" role="form" class="m-t" id="register_form"> |
|
101 |
<form action="registerService" method="POST" role="form" class="m-t uk-form-horizontal" id="register_form">
|
|
105 | 102 |
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/> |
106 | 103 |
<div class="alert alert-success" aria-hidden="true" style="display: none;"></div> |
107 | 104 |
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div> |
108 | 105 |
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span> |
109 | 106 |
<c:remove var="message" scope="session" /> |
110 |
<div class="form-group"> |
|
107 |
<h5 class="uk-h5">General</h5> |
|
108 |
<div class="uk-margin"> |
|
109 |
<label class="uk-form-label" for="form-horizontal-text">Name(*)</label> |
|
111 | 110 |
<span class="msg_first_name_error uk-text-danger uk-text-small uk-float-left" style='${msg_first_name_error_display}'>Please enter a name for your service.</span> |
112 |
<input id="first_name" name="first_name" type="text" placeholder="Name (*)" class="form-control" value=${first_name}></div>
|
|
111 |
<input id="first_name" name="first_name" type="text" placeholder="Name (*)" class="form-control" value=${first_name}> |
|
113 | 112 |
<c:remove var="msg_first_name_error_display" scope="session" /> |
114 | 113 |
<c:remove var="first_name" scope="session" /> |
115 |
<div class="form-group"> |
|
114 |
</div> |
|
115 |
<div class="uk-margin"> |
|
116 |
<label class="uk-form-label" for="form-horizontal-text">Description</label> |
|
116 | 117 |
<textarea id="description" name="description" type="textarea" placeholder="Description:" class="form-control uk-textarea" rows="3" value=${description}></textarea> |
117 | 118 |
<c:remove var="organization" scope="session" /> |
118 |
<div class="uk-width-1-1 uk-grid-margin uk-first-column"> |
|
119 |
<a type="submit" class="uk-button uk-button-default" href="./registeredServices">Cancel</a> |
|
120 |
<button type="submit" class="uk-button uk-button-primary" onclick="return validate();">Add new service</button> |
|
119 |
</div> |
|
120 |
<hr class="uk-margin-remove-top"> |
|
121 |
<h5 class="uk-h5">Access</h5> |
|
122 |
<div class="uk-margin"> |
|
123 |
<label class="uk-form-label" for="form-horizontal-text">Scope</label> |
|
124 |
<input disabled value="openid" class="uk-input"></input> |
|
125 |
</div> |
|
126 |
<div class="uk-margin"> |
|
127 |
<label class="uk-form-label" for="form-horizontal-text">Grant Types</label> |
|
128 |
<input disabled value="client credentials" class="uk-input"></input> |
|
129 |
</div> |
|
130 |
<hr class="uk-margin-remove-top"> |
|
131 |
<h5 class="uk-h5">Credentials</h5> |
|
132 |
<div class="uk-margin"> |
|
133 |
<label class="uk-form-label" for="form-horizontal-text">Authentication Method</label> |
|
134 |
<input disabled value="Asymmetrically-signed JWT assertion" class="uk-input"></input> |
|
135 |
</div> |
|
136 |
<div class="uk-margin"> |
|
137 |
<label class="uk-form-label" for="form-horizontal-text">Token Endpoint Authentication Signing Algorithm</label> |
|
138 |
<input disabled value="RSASSA using SHA-256 hash algorithm" class="uk-input"></input> |
|
139 |
</div> |
|
140 |
<div class="uk-margin"> |
|
141 |
<label class="uk-form-label" for="form-horizontal-text">Public Key Set</label> |
|
142 |
|
|
143 |
<label><input class="uk-radio" type="radio" name="key_radio" value="value" checked>By Value</label> |
|
144 |
<label><input class="uk-radio" type="radio" name="key_radio" value="uri">By URI</label><br> |
|
145 |
|
|
146 |
<div id="value_input"> |
|
147 |
<span class="msg_key_value_error uk-text-danger uk-text-small uk-float-left" style='${msg_key_value_error_display}'>Please provide a valid JSON.</span> |
|
148 |
<textarea id="value" name="value" type="textarea" placeholder='{"keys":[]}' class="form-control uk-textarea" rows="10"></textarea> |
|
121 | 149 |
</div> |
150 |
<div id="uri_input" style="display:none;"> |
|
151 |
<span class="msg_key_uri_error uk-text-danger uk-text-small uk-float-left" style='${msg_key_uri_error_display}'>Please provide a valid URI.</span> |
|
152 |
<input id="uri" name="uri" type="text" placeholder="https://" class="form-control" value="${jwksUri}"> |
|
153 |
</div> |
|
122 | 154 |
</div> |
155 |
<hr class="uk-margin-remove-top"> |
|
156 |
<div class="uk-width-1-1 uk-grid-margin uk-first-column"> |
|
157 |
<a type="submit" class="uk-button uk-button-default" href="./registeredServices">Cancel</a> |
|
158 |
<button type="submit" class="uk-button uk-button-primary" onclick="return validate();">Add new service</button> |
|
159 |
</div> |
|
123 | 160 |
</form> |
124 | 161 |
</div> |
125 | 162 |
<!-- END OF REGISTER FORM --> |
126 | 163 |
<script> |
164 |
$('input[type=radio][name=key_radio]').change(function() { |
|
165 |
if (this.value == 'uri') { |
|
166 |
$("#uri_input").show(); |
|
167 |
$("#value_input").hide(); |
|
168 |
|
|
169 |
} else if (this.value == 'value') { |
|
170 |
$("#uri_input").hide(); |
|
171 |
$("#value_input").show(); |
|
172 |
} |
|
173 |
}); |
|
174 |
|
|
127 | 175 |
function validate() { |
128 |
// Check if name is filled
|
|
176 |
var isValid = false;
|
|
129 | 177 |
if($("#first_name").val() != undefined) { |
130 | 178 |
if($.trim($("#first_name").val()).length <= 0) { |
131 | 179 |
$("#first_name").addClass('uk-input aai-form-danger'); |
... | ... | |
135 | 183 |
$(".msg_first_name_error").hide(); |
136 | 184 |
$("#first_name").removeClass('aai-form-danger'); |
137 | 185 |
} |
138 |
return true; |
|
139 | 186 |
} |
187 |
|
|
188 |
if ($('input[type=radio][name=key_radio]:checked').val()==='value') { |
|
189 |
isValid = validateJSON(); |
|
190 |
if (!isValid) { |
|
191 |
$("#value_input").addClass('uk-input aai-form-danger'); |
|
192 |
$(".msg_key_value_error_display").show(); |
|
193 |
return false; |
|
194 |
} |
|
195 |
} |
|
196 |
|
|
197 |
if ($('input[type=radio][name=key_radio]:checked').val()==='uri') { |
|
198 |
isValid = validateURI(); |
|
199 |
if (!isValid) { |
|
200 |
$("#uri_input").addClass('uk-input aai-form-danger'); |
|
201 |
$(".msg_key_uri_error_display").show(); |
|
202 |
return false; |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
140 | 206 |
} |
207 |
|
|
208 |
function validateJSON() { |
|
209 |
if ($("#value").val() != undefined && $("#value").val()!=="") { |
|
210 |
if (/^[\],:{}\s]*$/.test($("#value").val().replace(/\\["\\\/bfnrtu]/g, '@'). |
|
211 |
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). |
|
212 |
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { |
|
213 |
return true; |
|
214 |
|
|
215 |
} else { |
|
216 |
return false; |
|
217 |
} |
|
218 |
} |
|
219 |
return false; |
|
220 |
} |
|
221 |
|
|
222 |
function validateURI() { |
|
223 |
if ($("#uri").val() != undefined && $("#uri").val()!=="") { |
|
224 |
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol |
|
225 |
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name |
|
226 |
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address |
|
227 |
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path |
|
228 |
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string |
|
229 |
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator |
|
230 |
return !!pattern.test($("#uri").val()); |
|
231 |
} |
|
232 |
return false; |
|
233 |
} |
|
234 |
|
|
141 | 235 |
$("#first_name").focusin(function () { |
142 | 236 |
$(this).removeClass('aai-form-danger'); |
143 | 237 |
$(".msg_first_name_error").fadeOut(); |
144 | 238 |
}); |
239 |
|
|
240 |
$("#value_input").focusin(function () { |
|
241 |
$(this).removeClass('aai-form-danger'); |
|
242 |
$(".msg_key_value_error").fadeOut(); |
|
243 |
}); |
|
244 |
|
|
245 |
$("#uri_input").focusin(function () { |
|
246 |
$(this).removeClass('aai-form-danger'); |
|
247 |
$(".msg_key_uri_error").fadeOut(); |
|
248 |
}); |
|
145 | 249 |
</script> |
146 | 250 |
</div> |
147 | 251 |
</ul> |
Also available in: Unified diff
service registration with keys enabled