Authorized grant types now supported client-side

pull/105/merge
Michael Jett 2012-06-28 14:40:37 -04:00
parent bff34f647c
commit a022f4d713
2 changed files with 35 additions and 5 deletions

View File

@ -62,7 +62,7 @@
clientName:"",
clientSecret:"",
registeredRedirectUri:[],
authorizedGrantTypes:[],
authorizedGrantTypes:["authorization_code"],
scope:["openid"],
authorities:[],
clientDescription:"",
@ -196,12 +196,21 @@
registeredRedirectUri = [];
}
// build the grant type object
var authorizedGrantTypes = [];
$.each(["authorization_code","client_credentials","password","implicit"],function(index,type) {
if ($('#authorizedGrantTypes-' + type).is(':checked')) {
authorizedGrantTypes.push(type);
}
});
var valid = this.model.set({
clientName:$('#clientName input').val(),
clientSecret:$('#clientSecret input').val(),
registeredRedirectUri:registeredRedirectUri,
clientDescription:$('#clientDescription textarea').val(),
allowRefresh:$('#allowRefresh').is(':checked'),
authorizedGrantTypes: authorizedGrantTypes,
accessTokenValiditySeconds: $('#accessTokenValiditySeconds input').val(),
refreshTokenValiditySeconds: $('#refreshTokenValiditySeconds input').val(),
scope:$.map($('#scope textarea').val().replace(/,$/,'').replace(/\s/g,' ').split(","), $.trim)

View File

@ -144,14 +144,35 @@
</div>
<div class="span4 control-group" id="clientSecret">
<div class="span4 control-group">
<div 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>
</div>
<br/>
<div id="authorizedGrantTypes">
<label>Authorized Grant Types</label>
<label class="checkbox">
<input id="authorizedGrantTypes-authorization_code" type="checkbox" <%=($.inArray("authorization_code", authorizedGrantTypes) > -1 ? 'checked' : '')%>> authorization code
</label>
<label class="checkbox">
<input id="authorizedGrantTypes-client_credentials" type="checkbox" <%=($.inArray("client_credentials", authorizedGrantTypes) > -1 ? 'checked' : '')%>> client credentials
</label>
<label class="checkbox">
<input id="authorizedGrantTypes-password" type="checkbox" <%=($.inArray("password", authorizedGrantTypes) > -1 ? 'checked' : '')%>> password
</label>
<label class="checkbox">
<input id="authorizedGrantTypes-implicit" type="checkbox" <%=($.inArray("implicit", authorizedGrantTypes) > -1 ? 'checked' : '')%>> implicit
</label>
</div>
<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>
</div>
<div class="span4">
<span class="control-group" id="accessTokenValiditySeconds">
<label class="control-label" for="access-token-timeout-seconds" style="">Access Token