grant types rename

pull/306/merge
Justin Richer 12 years ago
parent 33c488d9ae
commit ac44020305

@ -21,7 +21,7 @@ var ClientModel = Backbone.Model.extend({
clientName:"",
clientSecret:"",
redirectUris:[],
authorizedGrantTypes:["authorization_code"],
grantTypes:["authorization_code"],
scope:[],
authorities:[],
clientDescription:"",
@ -289,7 +289,7 @@ var ClientFormView = Backbone.View.extend({
},
// maps from a form-friendly name to the real grant parameter name
authorizedGrantMap:{
grantMap:{
"authorization_code": "authorization_code",
"password": "password",
"implicit": "implicit",
@ -306,10 +306,10 @@ var ClientFormView = Backbone.View.extend({
var scopes = this.scopeCollection.pluck("item");
// build the grant type object
var authorizedGrantTypes = [];
$.each(this.authorizedGrantMap, function(index,type) {
if ($('#authorizedGrantTypes-' + index).is(':checked')) {
authorizedGrantTypes.push(type);
var grantTypes = [];
$.each(this.grantMap, function(index,type) {
if ($('#grantTypes-' + index).is(':checked')) {
grantTypes.push(type);
}
});
@ -318,10 +318,11 @@ var ClientFormView = Backbone.View.extend({
var clientSecret = null;
if (requireClientSecret && !generateClientSecret) {
// if it's required but we're not generating it, send the value
// if it's required but we're not generating it, send the value to preserve it
clientSecret = $('#clientSecret input').val();
}
// TODO: validate these as integers
var accessTokenValiditySeconds = null;
if (!$('disableAccessTokenTimeout').is(':checked')) {
accessTokenValiditySeconds = this.getFormTokenValue($('#accessTokenValiditySeconds input[type=text]').val());
@ -356,7 +357,7 @@ var ClientFormView = Backbone.View.extend({
redirectUris: this.redirectUrisCollection.pluck("item"),
clientDescription:$('#clientDescription textarea').val(),
logoUri:$('#logoUri input').val(),
authorizedGrantTypes: authorizedGrantTypes,
grantTypes: grantTypes,
accessTokenValiditySeconds: accessTokenValiditySeconds,
refreshTokenValiditySeconds: refreshTokenValiditySeconds,
idTokenValiditySeconds: idTokenValiditySeconds,

@ -138,38 +138,38 @@
</div>
</div>
<div class="control-group" id="authorizedGrantTypes">
<label class="control-label">Authorized Grant Types</label>
<div class="control-group" id="grantTypes">
<label class="control-label">Grant Types</label>
<div class="controls">
<label class="checkbox">
<input id="authorizedGrantTypes-authorization_code" type="checkbox"
<%=($.inArray("authorization_code", authorizedGrantTypes) > -1 ? 'checked' : '')%>>
<input id="grantTypes-authorization_code" type="checkbox"
<%=($.inArray("authorization_code", grantTypes) > -1 ? 'checked' : '')%>>
authorization code
</label>
<label class="checkbox">
<input id="authorizedGrantTypes-client_credentials" type="checkbox"
<%=($.inArray("client_credentials", authorizedGrantTypes) > -1 ? 'checked' : '')%>> client
<input id="grantTypes-client_credentials" type="checkbox"
<%=($.inArray("client_credentials", grantTypes) > -1 ? 'checked' : '')%>> client
credentials
</label>
<label class="checkbox">
<input id="authorizedGrantTypes-password" type="checkbox" <%=($.inArray("password",
authorizedGrantTypes) > -1 ? 'checked' : '')%>> password
<input id="grantTypes-password" type="checkbox" <%=($.inArray("password",
grantTypes) > -1 ? 'checked' : '')%>> password
</label>
<label class="checkbox">
<input id="authorizedGrantTypes-implicit" type="checkbox" <%=($.inArray("implicit",
authorizedGrantTypes) > -1 ? 'checked' : '')%>> implicit
<input id="grantTypes-implicit" type="checkbox" <%=($.inArray("implicit",
grantTypes) > -1 ? 'checked' : '')%>> implicit
</label>
<!--
<label class="checkbox">
<input id="authorizedGrantTypes-refresh_token" type="checkbox" <%=($.inArray("refresh_token",
authorizedGrantTypes) > -1 ? 'checked' : '')%>> refresh
<input id="grantTypes-refresh_token" type="checkbox" <%=($.inArray("refresh_token",
grantTypes) > -1 ? 'checked' : '')%>> refresh
</label>
-->
<label class="checkbox">
<input id="authorizedGrantTypes-redelegate" type="checkbox" <%=($.inArray("urn:ietf:params:oauth:grant_type:redelegate",
authorizedGrantTypes) > -1 ? 'checked' : '')%>> redelegate
<input id="grantTypes-redelegate" type="checkbox" <%=($.inArray("urn:ietf:params:oauth:grant_type:redelegate",
grantTypes) > -1 ? 'checked' : '')%>> redelegate
</label>
</div>

Loading…
Cancel
Save