updated display of saved client secret

pull/618/head
Justin Richer 11 years ago
parent d844b8e444
commit 04de4e8483

@ -686,9 +686,27 @@ var ClientFormView = Backbone.View.extend({
var generateClientSecret = $('#generateClientSecret input').is(':checked'); var generateClientSecret = $('#generateClientSecret input').is(':checked');
var clientSecret = null; var clientSecret = null;
if (!generateClientSecret) { var tokenEndpointAuthMethod = $('#tokenEndpointAuthMethod input').filter(':checked').val();
// if it's required but we're not generating it, send the value to preserve it
clientSecret = $('#clientSecret input').val(); // whether or not the client secret changed
var secretChanged = false;
if (tokenEndpointAuthMethod == 'SECRET_BASIC'
|| tokenEndpointAuthMethod == 'SECRET_POST'
|| tokenEndpointAuthMethod == 'SECRET_JWT') {
if (!generateClientSecret) {
// if it's required but we're not generating it, send the value to preserve it
clientSecret = $('#clientSecret input').val();
// if it's not the same as before, offer to display it
if (clientSecret != this.model.get('clientSecret')) {
secretChanged = true;
}
} else {
// it's being generated anew
secretChanged = true;
}
} }
var accessTokenValiditySeconds = null; var accessTokenValiditySeconds = null;
@ -729,15 +747,13 @@ var ClientFormView = Backbone.View.extend({
allowRefresh: $('#allowRefresh').is(':checked'), allowRefresh: $('#allowRefresh').is(':checked'),
allowIntrospection: $('#allowIntrospection input').is(':checked'), // <-- And here? --^ allowIntrospection: $('#allowIntrospection input').is(':checked'), // <-- And here? --^
scope: scopes, scope: scopes,
// TODO: items below this line are untested
tosUri: $('#tosUri input').val(), tosUri: $('#tosUri input').val(),
policyUri: $('#policyUri input').val(), policyUri: $('#policyUri input').val(),
clientUri: $('#clientUri input').val(), clientUri: $('#clientUri input').val(),
applicationType: $('#applicationType input').filter(':checked').val(), applicationType: $('#applicationType input').filter(':checked').val(),
jwksUri: $('#jwksUri input').val(), jwksUri: $('#jwksUri input').val(),
subjectType: $('#subjectType input').filter(':checked').val(), subjectType: $('#subjectType input').filter(':checked').val(),
tokenEndpointAuthMethod: $('#tokenEndpointAuthMethod input').filter(':checked').val(), tokenEndpointAuthMethod: tokenEndpointAuthMethod,
responseTypes: responseTypes, responseTypes: responseTypes,
sectorIdentifierUri: $('#sectorIdentifierUri input').val(), sectorIdentifierUri: $('#sectorIdentifierUri input').val(),
initiateLoginUri: $('#initiateLoginUri input').val(), initiateLoginUri: $('#initiateLoginUri input').val(),
@ -784,7 +800,13 @@ var ClientFormView = Backbone.View.extend({
$('#modalAlertLabel').html('Client Saved'); $('#modalAlertLabel').html('Client Saved');
$('#modalAlert .modal-body').html(_self.clientSavedTemplate(_self.model.toJSON())); var savedModel = {
clientId: _self.model.get('clientId'),
clientSecret: _self.model.get('clientSecret'),
secretChanged: secretChanged
};
$('#modalAlert .modal-body').html(_self.clientSavedTemplate(savedModel));
$('#modalAlert .modal-body #savedClientSecret').hide(); $('#modalAlert .modal-body #savedClientSecret').hide();

@ -702,11 +702,15 @@
<strong>ID:</strong> <input type="text" readonly style="cursor: text" class="token-full input-xxlarge" value="<%= clientId %>" /> <strong>ID:</strong> <input type="text" readonly style="cursor: text" class="token-full input-xxlarge" value="<%= clientId %>" />
</div> </div>
<% if (generateClientSecret && clientSecret != null && clientSecret != '') { %> <% if (secretChanged) { %>
<div> <div>
<strong>Secret:</strong> <button class="btn btn-mini" id="clientSaveShow">Show Secret</button> <strong>Secret:</strong> <button class="btn btn-mini" id="clientSaveShow">Show Secret</button>
<input type="text" id="savedClientSecret" readonly style="cursor: text" class="token-full input-xxlarge" value="<%= clientSecret %>" /> <input type="text" id="savedClientSecret" readonly style="cursor: text" class="token-full input-xxlarge" value="<%= clientSecret %>" />
</div> </div>
<% } else if (clientSecret == null || clientSecret == '') { %>
<div>
<i>No client secret</i>
</div>
<% } else { %> <% } else { %>
<div> <div>
<strong>Secret:</strong> <i>unchanged</i> <strong>Secret:</strong> <i>unchanged</i>

Loading…
Cancel
Save