tweaked functionality of grant types and scopes
parent
cc36851bdd
commit
829c8ae5f4
|
@ -520,21 +520,31 @@
|
||||||
"password": "password",
|
"password": "password",
|
||||||
"implicit": "implicit",
|
"implicit": "implicit",
|
||||||
"client_credentials": "client_credentials",
|
"client_credentials": "client_credentials",
|
||||||
"redelegate": "urn:ietf:params:oauth:grant_type:redelegate"
|
"redelegate": "urn:ietf:params:oauth:grant_type:redelegate",
|
||||||
|
"refresh_token": "refresh_token"
|
||||||
},
|
},
|
||||||
|
|
||||||
saveClient:function (event) {
|
saveClient:function (event) {
|
||||||
|
|
||||||
$('.control-group').removeClass('error');
|
$('.control-group').removeClass('error');
|
||||||
|
|
||||||
|
// build the scope object
|
||||||
|
var scopes = this.scopeCollection.pluck("item");
|
||||||
|
|
||||||
// build the grant type object
|
// build the grant type object
|
||||||
var authorizedGrantTypes = [];
|
var authorizedGrantTypes = [];
|
||||||
$.each(["authorization_code","client_credentials","password","implicit","urn:ietf:params:oauth:grant_type:redelegate"],function(index,type) {
|
$.each(authorizedGrantMap,function(index,type) {
|
||||||
if ($('#authorizedGrantTypes-' + type).is(':checked')) {
|
if ($('#authorizedGrantTypes-' + index).is(':checked')) {
|
||||||
authorizedGrantTypes.push(authorizedGrantMap[type]);
|
authorizedGrantTypes.push(type);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var allowRefresh = $('#allowRefresh').is(':checked');
|
||||||
|
if (allowRefresh) {
|
||||||
|
authorizedGrantTypes.push(authorizedGrantMap('refresh_token'));
|
||||||
|
scopes.push("offline");
|
||||||
|
}
|
||||||
|
|
||||||
var requireClientSecret = $('#requireClientSecret input').is(':checked');
|
var requireClientSecret = $('#requireClientSecret input').is(':checked');
|
||||||
var generateClientSecret = $('#generateClientSecret input').is(':checked');
|
var generateClientSecret = $('#generateClientSecret input').is(':checked');
|
||||||
var clientSecret = null;
|
var clientSecret = null;
|
||||||
|
@ -570,12 +580,11 @@
|
||||||
registeredRedirectUri: this.registeredRedirectUriCollection.pluck("item"),
|
registeredRedirectUri: this.registeredRedirectUriCollection.pluck("item"),
|
||||||
clientDescription:$('#clientDescription textarea').val(),
|
clientDescription:$('#clientDescription textarea').val(),
|
||||||
logoUrl:$('#logoUrl input').val(),
|
logoUrl:$('#logoUrl input').val(),
|
||||||
allowRefresh:$('#allowRefresh').is(':checked'),
|
|
||||||
authorizedGrantTypes: authorizedGrantTypes,
|
authorizedGrantTypes: authorizedGrantTypes,
|
||||||
accessTokenValiditySeconds: accessTokenValiditySeconds,
|
accessTokenValiditySeconds: accessTokenValiditySeconds,
|
||||||
refreshTokenValiditySeconds: refreshTokenValiditySeconds,
|
refreshTokenValiditySeconds: refreshTokenValiditySeconds,
|
||||||
idTokenValiditySeconds: idTokenValiditySeconds,
|
idTokenValiditySeconds: idTokenValiditySeconds,
|
||||||
scope: this.scopeCollection.pluck("item")
|
scope: scopes
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.model.get("allowRefresh") == false) {
|
if (this.model.get("allowRefresh") == false) {
|
||||||
|
@ -1101,6 +1110,12 @@
|
||||||
}, { silent: true });
|
}, { silent: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($.inArray("refresh_token", client.get("authorizedGrantTypes"))) {
|
||||||
|
client.set({
|
||||||
|
allowRefresh: true
|
||||||
|
}, { silent: true });
|
||||||
|
}
|
||||||
|
|
||||||
client.set({
|
client.set({
|
||||||
generateClientSecret:false,
|
generateClientSecret:false,
|
||||||
displayClientSecret:false
|
displayClientSecret:false
|
||||||
|
|
Loading…
Reference in New Issue