Skip to content

Commit 26d507d

Browse files
committed
default new client in UI to HEART-compliant values
1 parent d75bba2 commit 26d507d

File tree

1 file changed

+59
-27
lines changed
  • openid-connect-server-webapp/src/main/webapp/resources/js

1 file changed

+59
-27
lines changed

openid-connect-server-webapp/src/main/webapp/resources/js/admin.js

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -479,28 +479,47 @@ var AppRouter = Backbone.Router.extend({
479479

480480
var view = new ClientFormView({model:client, systemScopeList: this.systemScopeList});
481481
view.load(function() {
482-
// set up this new client to require a secret and have us autogenerate one
483482
var userInfo = getUserInfo();
484483
var contacts = [];
485484
if (userInfo != null && userInfo.email != null) {
486485
contacts.push(userInfo.email);
487486
}
488487

489-
client.set({
490-
tokenEndpointAuthMethod: "SECRET_BASIC",
491-
generateClientSecret:true,
492-
displayClientSecret:false,
493-
requireAuthTime:true,
494-
defaultMaxAge:60000,
495-
scope: _.uniq(_.flatten(app.systemScopeList.defaultScopes().pluck("value"))),
496-
accessTokenValiditySeconds:3600,
497-
idTokenValiditySeconds:600,
498-
grantTypes: ["authorization_code"],
499-
responseTypes: ["code"],
500-
subjectType: "PUBLIC",
501-
jwksType: "URI",
502-
contacts: contacts
503-
}, { silent: true });
488+
// use a different set of defaults based on heart mode flag
489+
if (heartMode) {
490+
client.set({
491+
tokenEndpointAuthMethod: "PRIVATE_KEY",
492+
generateClientSecret:false,
493+
displayClientSecret:false,
494+
requireAuthTime:true,
495+
defaultMaxAge:60000,
496+
scope: _.uniq(_.flatten(app.systemScopeList.defaultScopes().pluck("value"))),
497+
accessTokenValiditySeconds:3600,
498+
idTokenValiditySeconds:600,
499+
grantTypes: ["authorization_code"],
500+
responseTypes: ["code"],
501+
subjectType: "PUBLIC",
502+
jwksType: "URI",
503+
contacts: contacts
504+
}, { silent: true });
505+
} else {
506+
// set up this new client to require a secret and have us autogenerate one
507+
client.set({
508+
tokenEndpointAuthMethod: "SECRET_BASIC",
509+
generateClientSecret:true,
510+
displayClientSecret:false,
511+
requireAuthTime:true,
512+
defaultMaxAge:60000,
513+
scope: _.uniq(_.flatten(app.systemScopeList.defaultScopes().pluck("value"))),
514+
accessTokenValiditySeconds:3600,
515+
idTokenValiditySeconds:600,
516+
grantTypes: ["authorization_code"],
517+
responseTypes: ["code"],
518+
subjectType: "PUBLIC",
519+
jwksType: "URI",
520+
contacts: contacts
521+
}, { silent: true });
522+
}
504523

505524

506525
$('#content').html(view.render().el);
@@ -853,17 +872,30 @@ var AppRouter = Backbone.Router.extend({
853872
contacts.push(userInfo.email);
854873
}
855874

856-
client.set({
857-
require_auth_time:true,
858-
default_max_age:60000,
859-
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
860-
token_endpoint_auth_method: 'client_secret_basic',
861-
grant_types: ["authorization_code"],
862-
response_types: ["code"],
863-
subject_type: "public",
864-
contacts: contacts
865-
}, { silent: true });
866-
875+
if (heartMode) {
876+
client.set({
877+
require_auth_time:true,
878+
default_max_age:60000,
879+
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
880+
token_endpoint_auth_method: 'private_key_jwt',
881+
grant_types: ["authorization_code"],
882+
response_types: ["code"],
883+
subject_type: "public",
884+
contacts: contacts
885+
}, { silent: true });
886+
} else {
887+
client.set({
888+
require_auth_time:true,
889+
default_max_age:60000,
890+
scope: _.uniq(_.flatten(app.systemScopeList.defaultUnrestrictedScopes().pluck("value"))).join(" "),
891+
token_endpoint_auth_method: 'client_secret_basic',
892+
grant_types: ["authorization_code"],
893+
response_types: ["code"],
894+
subject_type: "public",
895+
contacts: contacts
896+
}, { silent: true });
897+
}
898+
867899
$('#content').html(view.render().el);
868900
view.delegateEvents();
869901
setPageTitle($.t('dynreg.new-client'));

0 commit comments

Comments
 (0)