Client secret now editable and dynamically generated if not present
parent
bd054bfd58
commit
e5312b4c99
|
@ -157,9 +157,13 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
|
||||||
@Override
|
@Override
|
||||||
public ClientDetailsEntity saveClient(ClientDetailsEntity client) {
|
public ClientDetailsEntity saveClient(ClientDetailsEntity client) {
|
||||||
|
|
||||||
|
if (client.getClientSecret().equals("")) {
|
||||||
|
client.setClientSecret(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
|
||||||
// this must be a new client if we don't have a clientID
|
// this must be a new client if we don't have a clientID
|
||||||
// assign it a new ID
|
// assign it a new ID
|
||||||
if (client.getClientId() == null || this.loadClientByClientId(client.getClientId()) == null) {
|
if (client.getClientId() == null || client.getClientId().equals("") || this.loadClientByClientId(client.getClientId()) == null) {
|
||||||
client.setClientId(UUID.randomUUID().toString());
|
client.setClientId(UUID.randomUUID().toString());
|
||||||
return this.createClient(client);
|
return this.createClient(client);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
// We can pass it default values.
|
// We can pass it default values.
|
||||||
defaults:{
|
defaults:{
|
||||||
clientName:"",
|
clientName:"",
|
||||||
|
clientSecret:"",
|
||||||
registeredRedirectUri:[""],
|
registeredRedirectUri:[""],
|
||||||
authorizedGrantTypes:[],
|
authorizedGrantTypes:[],
|
||||||
scope:["openid"],
|
scope:["openid"],
|
||||||
|
@ -190,6 +191,7 @@
|
||||||
|
|
||||||
this.model.set({
|
this.model.set({
|
||||||
clientName:$('#clientName input').val(),
|
clientName:$('#clientName input').val(),
|
||||||
|
clientSecret:$('#clientSecret input').val(),
|
||||||
registeredRedirectUri:$.trim($('#registeredRedirectUri textarea').val()).replace(/ /g,'').split("\n"),
|
registeredRedirectUri:$.trim($('#registeredRedirectUri textarea').val()).replace(/ /g,'').split("\n"),
|
||||||
clientDescription:$('#clientDescription textarea').val(),
|
clientDescription:$('#clientDescription textarea').val(),
|
||||||
allowRefresh:$('#allowRefresh').is(':checked'),
|
allowRefresh:$('#allowRefresh').is(':checked'),
|
||||||
|
|
|
@ -30,9 +30,7 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
<%=authorities[0]%>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<%=clientDescription%>
|
<%=clientDescription%>
|
||||||
</td>
|
</td>
|
||||||
|
@ -61,7 +59,6 @@
|
||||||
<th>Redirect URI(s)</th>
|
<th>Redirect URI(s)</th>
|
||||||
<th>Grant Types</th>
|
<th>Grant Types</th>
|
||||||
<th>Scope</th>
|
<th>Scope</th>
|
||||||
<th>Authority</th>
|
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>Refresh Tokens</th>
|
<th>Refresh Tokens</th>
|
||||||
<th class="span1"></th>
|
<th class="span1"></th>
|
||||||
|
@ -108,6 +105,12 @@
|
||||||
<textarea class="input-xlarge" placeholder="Type a description" maxlength="200"
|
<textarea class="input-xlarge" placeholder="Type a description" maxlength="200"
|
||||||
rows="3"><%=clientDescription%></textarea> <span class="help-inline"></span>
|
rows="3"><%=clientDescription%></textarea> <span class="help-inline"></span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span class="control-group" id="clientSecret">
|
||||||
|
<label>Client Secret</label>
|
||||||
|
<input value="<%=clientSecret%>" maxlength="100" type="text" class=""
|
||||||
|
placeholder="Type a secret"> <span class="help-inline">If you leave this blank a client secret will be generated for you automatically.</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue