ported credential handling UI to dyn reg and res reg pages

pull/618/head
Justin Richer 2014-06-09 18:13:43 -04:00
parent bafd951dac
commit d844b8e444
5 changed files with 60 additions and 43 deletions

View File

@ -489,7 +489,7 @@ var ClientFormView = Backbone.View.extend({
document.getElementById("refresh-token-timeout-time").value = ''; document.getElementById("refresh-token-timeout-time").value = '';
}, },
"click .btn-cancel":"cancel", "click .btn-cancel":"cancel",
"change #tokenEndpointAuthMethod input:radio":"toggleRequireClientSecret", "change #tokenEndpointAuthMethod input:radio":"toggleClientCredentials",
"change #displayClientSecret":"toggleDisplayClientSecret", "change #displayClientSecret":"toggleDisplayClientSecret",
"change #generateClientSecret":"toggleGenerateClientSecret", "change #generateClientSecret":"toggleGenerateClientSecret",
"change #logoUri input":"previewLogo" "change #logoUri input":"previewLogo"
@ -535,10 +535,10 @@ var ClientFormView = Backbone.View.extend({
}, },
/** /**
* Set up the form based on the current state of the requireClientSecret checkbox parameter * Set up the form based on the current state of the tokenEndpointAuthMethod parameter
* @param event * @param event
*/ */
toggleRequireClientSecret:function() { toggleClientCredentials:function() {
var tokenEndpointAuthMethod = $('#tokenEndpointAuthMethod input', this.el).filter(':checked').val(); var tokenEndpointAuthMethod = $('#tokenEndpointAuthMethod input', this.el).filter(':checked').val();
@ -898,7 +898,7 @@ var ClientFormView = Backbone.View.extend({
} }
// toggle other dynamic fields // toggle other dynamic fields
this.toggleRequireClientSecret(); this.toggleClientCredentials();
this.previewLogo(); this.previewLogo();
// disable unsupported JOSE algorithms // disable unsupported JOSE algorithms

View File

@ -187,7 +187,8 @@ var DynRegEditView = Backbone.View.extend({
"click .btn-save":"saveClient", "click .btn-save":"saveClient",
"click .btn-cancel":"cancel", "click .btn-cancel":"cancel",
"click .btn-delete":"deleteClient", "click .btn-delete":"deleteClient",
"change #logoUri input":"previewLogo" "change #logoUri input":"previewLogo",
"change #tokenEndpointAuthMethod input:radio":"toggleClientCredentials"
}, },
cancel:function(e) { cancel:function(e) {
@ -240,6 +241,23 @@ var DynRegEditView = Backbone.View.extend({
} }
}, },
/**
* Set up the form based on the current state of the tokenEndpointAuthMethod parameter
* @param event
*/
toggleClientCredentials:function() {
var tokenEndpointAuthMethod = $('#tokenEndpointAuthMethod input', this.el).filter(':checked').val();
// show or hide the signing algorithm method depending on what's selected
if (tokenEndpointAuthMethod == 'private_key_jwt'
|| tokenEndpointAuthMethod == 'client_secret_jwt') {
$('#tokenEndpointAuthSigningAlg', this.el).show();
} else {
$('#tokenEndpointAuthSigningAlg', this.el).hide();
}
},
disableUnsupportedJOSEItems:function(serverSupported, query) { disableUnsupportedJOSEItems:function(serverSupported, query) {
var supported = ['default']; var supported = ['default'];
if (serverSupported) { if (serverSupported) {
@ -450,6 +468,7 @@ var DynRegEditView = Backbone.View.extend({
// TODO: autocomplete from spec // TODO: autocomplete from spec
collection: this.defaultAcrValuesCollection}).render().el); collection: this.defaultAcrValuesCollection}).render().el);
this.toggleClientCredentials();
this.previewLogo(); this.previewLogo();
// disable unsupported JOSE algorithms // disable unsupported JOSE algorithms

View File

@ -187,7 +187,8 @@ var ResRegEditView = Backbone.View.extend({
"click .btn-save":"saveClient", "click .btn-save":"saveClient",
"click .btn-cancel":"cancel", "click .btn-cancel":"cancel",
"click .btn-delete":"deleteClient", "click .btn-delete":"deleteClient",
"change #logoUri input":"previewLogo" "change #logoUri input":"previewLogo",
"change #tokenEndpointAuthMethod input:radio":"toggleClientCredentials"
}, },
cancel:function(e) { cancel:function(e) {
@ -240,6 +241,23 @@ var ResRegEditView = Backbone.View.extend({
} }
}, },
/**
* Set up the form based on the current state of the tokenEndpointAuthMethod parameter
* @param event
*/
toggleClientCredentials:function() {
var tokenEndpointAuthMethod = $('#tokenEndpointAuthMethod input', this.el).filter(':checked').val();
// show or hide the signing algorithm method depending on what's selected
if (tokenEndpointAuthMethod == 'private_key_jwt'
|| tokenEndpointAuthMethod == 'client_secret_jwt') {
$('#tokenEndpointAuthSigningAlg', this.el).show();
} else {
$('#tokenEndpointAuthSigningAlg', this.el).hide();
}
},
disableUnsupportedJOSEItems:function(serverSupported, query) { disableUnsupportedJOSEItems:function(serverSupported, query) {
var supported = ['default']; var supported = ['default'];
if (serverSupported) { if (serverSupported) {
@ -264,27 +282,6 @@ var ResRegEditView = Backbone.View.extend({
} }
}, },
// maps from a form-friendly name to the real grant parameter name
grantMap:{
'authorization_code': 'authorization_code',
'password': 'password',
'implicit': 'implicit',
'client_credentials': 'client_credentials',
'redelegate': 'urn:ietf:params:oauth:grant_type:redelegate',
'refresh_token': 'refresh_token'
},
// maps from a form-friendly name to the real response type parameter name
responseMap:{
'code': 'code',
'token': 'token',
'idtoken': 'id_token',
'token-idtoken': 'token id_token',
'code-idtoken': 'code id_token',
'code-token': 'code token',
'code-token-idtoken': 'code token id_token'
},
saveClient:function (e) { saveClient:function (e) {
e.preventDefault(); e.preventDefault();
@ -415,6 +412,7 @@ var ResRegEditView = Backbone.View.extend({
// TODO: autocomplete from spec // TODO: autocomplete from spec
collection: this.defaultAcrValuesCollection}).render().el); collection: this.defaultAcrValuesCollection}).render().el);
this.toggleClientCredentials();
this.previewLogo(); this.previewLogo();
// disable unsupported JOSE algorithms // disable unsupported JOSE algorithms

View File

@ -325,14 +325,6 @@
</div> </div>
</div> </div>
<div class="control-group" id="jwksUri">
<label class="control-label">JWK Set</label>
<div class="controls">
<input placeholder="https://" value="<%=client.jwks_uri ? client.jwks_uri : ''%>" maxlength="1000" type="text" class=""/>
<p class="help-block">URL for the client's JSON Web Key set</p>
</div>
</div>
<div class="control-group" id="tokenEndpointAuthSigningAlg"> <div class="control-group" id="tokenEndpointAuthSigningAlg">
<label class="control-label">Token Endpoint Authentication Signing Algorithm</label> <label class="control-label">Token Endpoint Authentication Signing Algorithm</label>
<div class="controls"> <div class="controls">
@ -351,6 +343,14 @@
</div> </div>
</div> </div>
<div class="control-group" id="jwksUri">
<label class="control-label">JWK Set</label>
<div class="controls">
<input placeholder="https://" value="<%=client.jwks_uri ? client.jwks_uri : ''%>" maxlength="1000" type="text" class=""/>
<p class="help-block">URL for the client's JSON Web Key set</p>
</div>
</div>
</div> </div>
<div class="tab-pane" id="client-crypto-tab"> <div class="tab-pane" id="client-crypto-tab">

View File

@ -240,14 +240,6 @@
</div> </div>
</div> </div>
<div class="control-group" id="jwksUri">
<label class="control-label">JWK Set</label>
<div class="controls">
<input placeholder="https://" value="<%=client.jwks_uri ? client.jwks_uri : ''%>" maxlength="1000" type="text" class=""/>
<p class="help-block">URL for the client's JSON Web Key set</p>
</div>
</div>
<div class="control-group" id="tokenEndpointAuthSigningAlg"> <div class="control-group" id="tokenEndpointAuthSigningAlg">
<label class="control-label">Introspection Endpoint Authentication Signing Algorithm</label> <label class="control-label">Introspection Endpoint Authentication Signing Algorithm</label>
<div class="controls"> <div class="controls">
@ -266,6 +258,14 @@
</div> </div>
</div> </div>
<div class="control-group" id="jwksUri">
<label class="control-label">JWK Set</label>
<div class="controls">
<input placeholder="https://" value="<%=client.jwks_uri ? client.jwks_uri : ''%>" maxlength="1000" type="text" class=""/>
<p class="help-block">URL for the client's JSON Web Key set</p>
</div>
</div>
</div> </div>
<div class="tab-pane" id="resource-json-tab"> <div class="tab-pane" id="resource-json-tab">