Revision 59655
Added by Katerina Iatropoulou about 4 years ago
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/RegisterServiceServlet.java | ||
---|---|---|
65 | 65 |
String name = request.getParameter("first_name").trim(); |
66 | 66 |
String description = request.getParameter("description").trim(); |
67 | 67 |
String keyType = request.getParameter("key_radio").trim(); |
68 |
|
|
69 | 68 |
String jwksUri = null; |
70 | 69 |
String jwksString = null; |
71 | 70 |
Jwks jwks = null; |
72 | 71 |
|
72 |
|
|
73 | 73 |
if (keyType.equals("uri")) { |
74 | 74 |
jwksUri = request.getParameter("uri"); |
75 | 75 |
String[] schemes = {"https"}; |
76 | 76 |
UrlValidator urlValidator = new UrlValidator(schemes); |
77 | 77 |
if (!urlValidator.isValid(jwksUri)){ |
78 |
System.out.println("Not valid? " + jwksUri); |
|
79 | 78 |
request.getSession().setAttribute("msg_key_uri_error_display", "display:block"); |
80 | 79 |
canProceed = false; |
81 | 80 |
} |
... | ... | |
83 | 82 |
jwksString = request.getParameter("value"); |
84 | 83 |
try { |
85 | 84 |
Gson gson = new GsonBuilder().registerTypeAdapter(Jwks.class, new JwksDeserializer()).create(); |
86 |
jwks = gson.fromJson(jwksString, Jwks.class); |
|
85 |
String jwksSet = String.format("{\"keys\":[%s]}", jwksString); |
|
86 |
jwks = gson.fromJson(jwksSet, Jwks.class); |
|
87 | 87 |
if (jwks.getKeys() == null || jwks.getKeys().length == 0) { |
88 | 88 |
System.out.println("Something wrong with the keys."); |
89 | 89 |
request.getSession().setAttribute("msg_key_value_error_display", "display:block"); |
modules/dnet-openaire-users/trunk/src/main/webapp/registerService.jsp | ||
---|---|---|
97 | 97 |
<label class="uk-form-label uk-text-bold">Public Key Set</label> |
98 | 98 |
<span class="uk-float-right"> |
99 | 99 |
<span class="uk-margin-small-right"> |
100 |
<input id="by_value" class="uk-radio uk-margin-small-right" type="radio" name="key_radio" value="value" checked>
|
|
100 |
<input id="by_value" class="uk-radio uk-margin-small-right" type="radio" name="key_radio" value="value" ${(key_radio == 'value' || key_radio == '' || key_radio == null) ? 'checked' : ''}>
|
|
101 | 101 |
<label class="clickable" for="by_value">By Value</label> |
102 | 102 |
</span> |
103 | 103 |
<span> |
104 |
<input id="by_uri" class="uk-radio uk-margin-small-right" type="radio" name="key_radio" value="uri"> |
|
104 |
<input id="by_uri" class="uk-radio uk-margin-small-right" type="radio" name="key_radio" value="uri" ${key_radio == 'uri' ? 'checked' : ''}>
|
|
105 | 105 |
<label class="clickable" for="by_uri">By URI</label> |
106 | 106 |
</span> |
107 | 107 |
</span> |
108 | 108 |
<div id="value_input"> |
109 |
<textarea id="value" name="value" type="textarea" placeholder='{"keys":[]}'
|
|
110 |
class="form-control uk-textarea" rows="10">{"keys":[]}</textarea>
|
|
109 |
<textarea id="value" name="value" type="textarea" placeholder='{"kty": ..., "e": ... , "use": ... , "kid": ..., "alg": ... , "n": ...}'
|
|
110 |
class="form-control uk-textarea" rows="10">${value}</textarea>
|
|
111 | 111 |
<span class="uk-text-danger uk-text-small">Please provide a valid JSON.</span> |
112 | 112 |
</div> |
113 | 113 |
<div id="uri_input" style="display:none;"> |
Also available in: Unified diff
form containing only one private key