grant types rename

pull/306/merge
Justin Richer 2013-03-04 17:10:45 -05:00
parent 33c488d9ae
commit ac44020305
2 changed files with 23 additions and 22 deletions

View File

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

View File

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