From fb66af2071eeaeb857f74c8c51b24f6b95ac84dc Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Wed, 28 Aug 2013 14:20:20 -0400 Subject: [PATCH] added form editor and control for newly-registered clients --- .../src/main/webapp/resources/js/admin.js | 20 +- .../src/main/webapp/resources/js/dynreg.js | 101 ++++ .../webapp/resources/template/dynreg.html | 468 +++++++++++++++++- 3 files changed, 576 insertions(+), 13 deletions(-) diff --git a/openid-connect-server/src/main/webapp/resources/js/admin.js b/openid-connect-server/src/main/webapp/resources/js/admin.js index a8056eb4e..4a2f1343b 100644 --- a/openid-connect-server/src/main/webapp/resources/js/admin.js +++ b/openid-connect-server/src/main/webapp/resources/js/admin.js @@ -332,6 +332,7 @@ var AppRouter = Backbone.Router.extend({ "user/profile":"notImplemented", "dev/dynreg":"dynReg", + "dev/dynreg/new":"newDynReg", "": "root" @@ -644,8 +645,25 @@ var AppRouter = Backbone.Router.extend({ {text:"Home", href:""}, {text:"Client Registration", href:"manage/#dev/dynreg"} ]); - $('#content').html($('#tmpl-dynreg').html()); + + this.dynRegRootView = new DynRegRootView(); + $('#content').html(this.dynRegRootView.render().el); + setPageTitle("Self-service Client Registration"); + }, + + newDynReg:function() { + this.breadCrumbView.collection.reset(); + this.breadCrumbView.collection.add([ + {text:"Home", href:""}, + {text:"Client Registration", href:"manage/#dev/dynreg"}, + {text:"New", href:"manage/#dev/dynreg/new"} + ]); + + this.dynRegEditView = new DynRegEditView({model: new DynRegClient()}); + $('#content').html(this.dynRegEditView.render().el); + + setPageTitle("Register a New Client"); } diff --git a/openid-connect-server/src/main/webapp/resources/js/dynreg.js b/openid-connect-server/src/main/webapp/resources/js/dynreg.js index e69de29bb..28deda8c4 100644 --- a/openid-connect-server/src/main/webapp/resources/js/dynreg.js +++ b/openid-connect-server/src/main/webapp/resources/js/dynreg.js @@ -0,0 +1,101 @@ +var DynRegClient = Backbone.Model.extend({ + idAttribute: "client_id", + + defaults:{ + client_id:null, + client_secret:null, + redirect_uris:[], + client_name:null, + client_uri:null, + logo_uri:null, + contacts:[], + tos_uri:null, + token_endpoint_auth_method:null, + scope:null, + grant_types:[], + response_types:[], + policy_uri:null, + jwks_uri:null, + + application_type:null, + sector_identifier_uri:null, + subject_type:null, + + request_object_signing_alg:null, + + userinfo_signed_response_alg:null, + userinfo_encrypted_response_alg:null, + userinfo_encrypted_response_enc:null, + + id_token_signed_response_alg:null, + id_token_encrypted_response_alg:null, + id_token_encrypted_response_enc:null, + + default_max_age:null, + require_auth_time:false, + default_acr_values:null, + + initiate_login_uri:null, + post_logout_redirect_uri:null, + + request_uris:[], + + client_description:null, + }, + + urlRoot:'register' + +}); + +var DynRegRootView = Backbone.View.extend({ + + tagName: 'span', + + initialize:function() { + + }, + + events:{ + "click #newreg":"newReg", + "click #editreg":"editReg" + }, + + render:function() { + $(this.el).html($('#tmpl-dynreg').html()); + return this; + }, + + newReg:function() { + this.remove(); + app.navigate('dev/dynreg/new', {trigger: true}); + }, + + editReg:function() { + + } + +}); + +var DynRegEditView = Backbone.View.extend({ + + tagName: 'span', + + initialize:function() { + if (!this.template) { + this.template = _.template($('#tmpl-dynreg-client-form').html()); + } + + this.redirectUrisCollection = new Backbone.Collection(); + this.scopeCollection = new Backbone.Collection(); + this.contactsCollection = new Backbone.Collection(); + this.defaultAcrValuesCollection = new Backbone.Collection(); + this.requestUrisCollection = new Backbone.Collection(); + }, + + render:function() { + $(this.el).html(this.template(this.model.toJSON())); + + return this; + } + +}); \ No newline at end of file diff --git a/openid-connect-server/src/main/webapp/resources/template/dynreg.html b/openid-connect-server/src/main/webapp/resources/template/dynreg.html index 46cbce4a2..bdc62ffcf 100644 --- a/openid-connect-server/src/main/webapp/resources/template/dynreg.html +++ b/openid-connect-server/src/main/webapp/resources/template/dynreg.html @@ -18,21 +18,465 @@ - \ No newline at end of file + +