Client secret now editable and dynamically generated if not present

pull/105/merge
Michael Jett 13 years ago
parent bd054bfd58
commit e5312b4c99

@ -157,9 +157,13 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
@Override
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
// 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());
return this.createClient(client);
} else {

@ -59,6 +59,7 @@
// We can pass it default values.
defaults:{
clientName:"",
clientSecret:"",
registeredRedirectUri:[""],
authorizedGrantTypes:[],
scope:["openid"],
@ -190,6 +191,7 @@
this.model.set({
clientName:$('#clientName input').val(),
clientSecret:$('#clientSecret input').val(),
registeredRedirectUri:$.trim($('#registeredRedirectUri textarea').val()).replace(/ /g,'').split("\n"),
clientDescription:$('#clientDescription textarea').val(),
allowRefresh:$('#allowRefresh').is(':checked'),

@ -30,9 +30,7 @@
<% } %>
</ul>
</td>
<td>
<%=authorities[0]%>
</td>
<td>
<%=clientDescription%>
</td>
@ -61,7 +59,6 @@
<th>Redirect URI(s)</th>
<th>Grant Types</th>
<th>Scope</th>
<th>Authority</th>
<th>Description</th>
<th>Refresh Tokens</th>
<th class="span1"></th>
@ -108,6 +105,12 @@
<textarea class="input-xlarge" placeholder="Type a description" maxlength="200"
rows="3"><%=clientDescription%></textarea> <span class="help-inline"></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>

Loading…
Cancel
Save