diff --git a/conf-sso/extra-db-mysql.sql b/conf-sso/extra-db-mysql.sql index 831f84f..69d150b 100644 --- a/conf-sso/extra-db-mysql.sql +++ b/conf-sso/extra-db-mysql.sql @@ -31,3 +31,11 @@ CREATE TABLE sso_federate ( UNIQUE INDEX by_local (provider, local_name), UNIQUE INDEX by_remote (provider, remote_name) ); + +############################################################################## +# Table Additions +############################################################################## + +# Add the "Identity Federations" menu item to the profile menu. +INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES + (2, 100, 'TEXT', 'Identity Federations', 'SERVLET', 'sourceid/federations.js.vs?tgt=${target}'); diff --git a/conf/venice-db-init-mysql.sql b/conf/venice-db-init-mysql.sql index 1bb0278..ed379a5 100644 --- a/conf/venice-db-init-mysql.sql +++ b/conf/venice-db-init-mysql.sql @@ -574,12 +574,16 @@ INSERT INTO globalprop (nsid, prop_name, prop_value) VALUES (6, 'bnc.configure', '!Configure' ), (6, 'bn.create', '!create.jpg' ), (6, 'bnc.create', '!Create' ), + (6, 'bn.federate', '!federate.jpg' ), + (6, 'bnc.federate', '!Federate' ), (6, 'bn.i.accept', '!user_accept.jpg' ), (6, 'bnc.i.accept', '!I Accept' ), (6, 'bn.i.decline', '!user_decline.jpg' ), (6, 'bnc.i.decline', '!I Decline' ), (6, 'bn.login', '!login.jpg' ), (6, 'bnc.login', '!Log In' ), + (6, 'bn.logout', '!logout.jpg' ), + (6, 'bnc.logout', '!Log Out' ), (6, 'bn.next', '!arrow_next.jpg' ), (6, 'bnc.next', '!Next' ), (6, 'bn.ok', '!ok.jpg' ), @@ -596,6 +600,8 @@ INSERT INTO globalprop (nsid, prop_name, prop_value) VALUES (6, 'bnc.send.email', '!Send E-Mail' ), (6, 'bn.set', '!set.jpg' ), (6, 'bnc.set', '!Set' ), + (6, 'bn.terminate', '!terminate.jpg' ), + (6, 'bnc.terminate', '!Terminate' ), (6, 'bn.update', '!update.jpg' ), (6, 'bnc.update', '!Update' ), (6, 'user.agreement.title', '!Venice User Agreement' ), diff --git a/venice-data-sso/sp/scripts/sourceid/defederate.js b/venice-data-sso/sp/scripts/sourceid/defederate.js index 1787426..07e4403 100644 --- a/venice-data-sso/sp/scripts/sourceid/defederate.js +++ b/venice-data-sso/sp/scripts/sourceid/defederate.js @@ -20,21 +20,27 @@ importPackage(Packages.com.silverwrist.dynamo.util); req = bsf.lookupBean("request"); // get request rhelp = bsf.lookupBean("request_help"); // get request helper session = rhelp.session; +target = req_help.getParameterString("tgt"); +if (target==null) + target = "top.js.vs"; +vlib.setOnError(req,target); // Make sure we're logged in. user = vlib.getUser(session); if (user.isAnonymous()) dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs")); +return_URL = "sourceid/federations.js.vs?tgt=" + stringutils.encodeURL(target); + // Make sure a provider ID is provided. provider = rhelp.getParameterString("provider"); if (provider==null) - dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs")); + dynamo.scriptReturn(new Redirect("SERVLET",return_URL)); // Create a defederation request. rc = new ForwardToPath("/sso/fedterm"); rc.setParameter("ProviderID",provider); rc.setParameter("UserID",user); // pass our user object to SourceID -rc.setParameter("Return.Success","/top.js.vs"); -rc.setParameter("Return.Failure","/top.js.vs"); +rc.setParameter("Return.Success","/" + return_URL); +rc.setParameter("Return.Failure","/" + return_URL); dynamo.scriptReturn(rc); diff --git a/venice-data-sso/sp/scripts/sourceid/federate.js b/venice-data-sso/sp/scripts/sourceid/federate.js index 79cf7a9..e2cf406 100644 --- a/venice-data-sso/sp/scripts/sourceid/federate.js +++ b/venice-data-sso/sp/scripts/sourceid/federate.js @@ -20,16 +20,22 @@ importPackage(Packages.com.silverwrist.dynamo.util); req = bsf.lookupBean("request"); // get request rhelp = bsf.lookupBean("request_help"); // get request helper session = rhelp.session; +target = req_help.getParameterString("tgt"); +if (target==null) + target = "top.js.vs"; +vlib.setOnError(req,target); // Make sure we're logged in. user = vlib.getUser(session); if (user.isAnonymous()) dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs")); +return_URL = "sourceid/federations.js.vs?tgt=" + stringutils.encodeURL(target); + // Make sure a provider ID is provided. provider = rhelp.getParameterString("provider"); if (provider==null) - dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs")); + dynamo.scriptReturn(new Redirect("SERVLET",return_URL)); // Create an Authenticate + Federate request and send it off. rc = new ForwardToPath("/sso/authnRequest"); @@ -38,6 +44,6 @@ rc.setParameter("IsPassive",cast.booleanObject(false)); rc.setParameter("ForceAuthn",cast.booleanObject(false)); rc.setParameter("Federate",cast.booleanObject(true)); rc.setParameter("UserID",user); // pass our user object to SourceID -rc.setParameter("Return.Success","/top.js.vs"); -rc.setParameter("Return.Failure","/top.js.vs"); +rc.setParameter("Return.Success","/" + return_URL); +rc.setParameter("Return.Failure","/" + return_URL); dynamo.scriptReturn(rc); diff --git a/venice-data-sso/sp/scripts/sourceid/federations.js b/venice-data-sso/sp/scripts/sourceid/federations.js new file mode 100644 index 0000000..0ff68c7 --- /dev/null +++ b/venice-data-sso/sp/scripts/sourceid/federations.js @@ -0,0 +1,95 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.org.sourceid.sso.util); +importPackage(Packages.org.sourceid.sso.xml); +importPackage(Packages.org.sourceid.sso.xml.lib); +importClass(Packages.com.silverwrist.dynamo.Namespaces); +importPackage(Packages.com.silverwrist.dynamo.iface); +importPackage(Packages.com.silverwrist.dynamo.util); +importClass(Packages.com.silverwrist.venice.VeniceNamespaces); +importPackage(Packages.com.silverwrist.venice.content); +importPackage(Packages.com.silverwrist.venice.frame); + +req = bsf.lookupBean("request"); +req_help = bsf.lookupBean("request_help"); +target = req_help.getParameterString("tgt"); +if (target==null) + target = "top.js.vs"; +vlib.setOnError(req,target); +user = vlib.getUser(req); + +// Check the user account. +user = vlib.getUser(req); +if (user.isAnonymous()) +{ // user not logged in, must log in first - so bounce us to the login dialog + new_target = "sourceid/federations.js.vs?tgt=" + stringutils.encodeURL(target); + dynamo.scriptReturn(new Redirect("SERVLET","login.js.vs?tgt=" + stringutils.encodeURL(new_target))); + +} // end if + +// Load the profile menu. +mprov = vcast.queryMenuProvider(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-menus")); +menu = mprov.getInlineMenu(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"user.profile.menu",cast.newIntArray(0)); +if (menu.getItemCount()>1) +{ // set up the menu properly + menu.setVariable("target",stringutils.encodeURL(target)); + ndx = menu.getItemContainingLinkText("sourceid/federations.js.vs"); + menu.setSelectedIndex(ndx); + +} // end if +else // don't display the menu + menu = null; + +// Create the return value. +rc = new VelocityView("Identity Federations","sourceid/federations.vm"); +rc.setParameter("target",target); +if (menu!=null) + rc.setParameter("menu",menu); + +// Get the list of identity providers and a bunch of information about them. +pdir = sourceid.getProviderDirectory(req); +it = pdir.getIDPList().iterator(); +plist = new ArrayList(); +while (it.hasNext()) +{ // get each identity provider in turn + map = new HashMap(); + idp = sourceid.castIDPDescriptorType(it.next()); + map.put("provider",idp.providerID); + sps = sourceid.getSessionInfoForProvider(req,idp.providerID); + if (sps!=null) + { // we're logged into this session - get the attributes of it + map.put("logged_in",cast.booleanObject(true)); + astmt = sps.getAuthenticationStatement(); + map.put("login_time",astmt.getAuthenticationInstant()); + ex_time = astmt.getReauthenticateOnOrAfter(); + if (ex_time!=null) + map.put("expire_time",ex_time); + + } // end if + else // not logged in + map.put("logged_in",cast.booleanObject(false)); + + map.put("federated",cast.booleanObject(sourceid.isUserFederatedWith(req,idp.providerID))); + + plist.add(map); // add to provider list + +} // end while + +rc.setParameter("provider_data",plist); + +dynamo.scriptOutput(rc); // all done diff --git a/venice-data-sso/sp/scripts/sourceid/logout_sso.js b/venice-data-sso/sp/scripts/sourceid/logout_sso.js index 93dce81..4245de0 100644 --- a/venice-data-sso/sp/scripts/sourceid/logout_sso.js +++ b/venice-data-sso/sp/scripts/sourceid/logout_sso.js @@ -20,16 +20,22 @@ importPackage(Packages.com.silverwrist.dynamo.util); req = bsf.lookupBean("request"); // get request rhelp = bsf.lookupBean("request_help"); // get request helper session = rhelp.session; +target = req_help.getParameterString("tgt"); +if (target==null) + target = "top.js.vs"; +vlib.setOnError(req,target); // Make sure we're logged in. user = vlib.getUser(session); if (user.isAnonymous()) dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs")); +return_URL = "sourceid/federations.js.vs?tgt=" + stringutils.encodeURL(target); + // Make sure a provider ID is provided. provider = rhelp.getParameterString("provider"); if (provider==null) - dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs")); + dynamo.scriptReturn(new Redirect("SERVLET",return_URL)); // Log out locally first. session.detach(); diff --git a/venice-data-sso/sp/scripts/top.js b/venice-data-sso/sp/scripts/top.js deleted file mode 100644 index 1e4c931..0000000 --- a/venice-data-sso/sp/scripts/top.js +++ /dev/null @@ -1,72 +0,0 @@ -// The contents of this file are subject to the Mozilla Public License Version 1.1 -// (the "License"); you may not use this file except in compliance with the License. -// You may obtain a copy of the License at . -// -// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT -// WARRANTY OF ANY KIND, either express or implied. See the License for the specific -// language governing rights and limitations under the License. -// -// The Original Code is the Venice Web Communities System. -// -// The Initial Developer of the Original Code is Eric J. Bowersox , -// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are -// Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. -// -// Contributor(s): - -importPackage(java.util); -importPackage(Packages.org.sourceid.sso.util); -importPackage(Packages.org.sourceid.sso.xml); -importPackage(Packages.org.sourceid.sso.xml.lib); -importPackage(Packages.com.silverwrist.dynamo.iface); -importPackage(Packages.com.silverwrist.dynamo.util); -importClass(Packages.com.silverwrist.venice.VeniceNamespaces); -importPackage(Packages.com.silverwrist.venice.content); -importPackage(Packages.com.silverwrist.venice.frame); - -req = bsf.lookupBean("request"); -req_help = bsf.lookupBean("request_help"); -user = vlib.getUser(req); - -// N.B. THIS IS ALL TEMPORARY - -// Create the return value. -rc = new VelocityView("Temporary SourceID Top Page","sourceid/top.vm"); -logged_in = !(user.isAnonymous()); -rc.setParameter("logged_in",cast.booleanObject(logged_in)); - -if (logged_in) -{ // Get the list of identity providers and a bunch of information about them. - pdir = sourceid.getProviderDirectory(req); - it = pdir.getIDPList().iterator(); - plist = new ArrayList(); - while (it.hasNext()) - { // get each identity provider in turn - map = new HashMap(); - idp = sourceid.castIDPDescriptorType(it.next()); - map.put("provider",idp.providerID); - sps = sourceid.getSessionInfoForProvider(req,idp.providerID); - if (sps!=null) - { // we're logged into this session - get the attributes of it - map.put("logged_in",cast.booleanObject(true)); - astmt = sps.getAuthenticationStatement(); - map.put("login_time",astmt.getAuthenticationInstant()); - ex_time = astmt.getReauthenticateOnOrAfter(); - if (ex_time!=null) - map.put("expire_time",ex_time); - - } // end if - else // not logged in - map.put("logged_in",cast.booleanObject(false)); - - map.put("federated",cast.booleanObject(sourceid.isUserFederatedWith(req,idp.providerID))); - - plist.add(map); // add to provider list - - } // end while - - rc.setParameter("provider_data",plist); - -} // end if - -dynamo.scriptReturn(rc); diff --git a/venice-data-sso/sp/velocity/sourceid/federations.vm b/venice-data-sso/sp/velocity/sourceid/federations.vm new file mode 100644 index 0000000..52c251d --- /dev/null +++ b/venice-data-sso/sp/velocity/sourceid/federations.vm @@ -0,0 +1,76 @@ +#* + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +*# +#* + Parameters: + menu = Menu to display along the top (may be null) + provider_data = List of identity provider data. + target = Target page attribute. +*# +#set( $et = "#encodeURL( $target )" ) +#if( $menu ) + #render( $menu ) +#end +#header1( "Identity Federations" ) +

This site can use a federated identity from any of the following identity providers:

+
+ + + + + + + + #foreach( $p in $provider_data ) + #set( $ep = "#encodeURL( $p.provider )" ) + + + + + + + + #end +
Provider IDLogged in at:Session expires:Federated 
#encodeHTML( $p.provider ) + #if( $p.logged_in ) + #formatDate( $p.login_time ) + #else +   + #end + + #if( $p.logged_in && $p.expire_time ) + #formatDate( $p.expire_time ) + #else +   + #end + + #if( $p.federated ) + Yes + #else + No + #end + + #if( $p.federated ) +#button( "IMAGE" "terminate" ) + #else +#button( "IMAGE" "federate" ) + #end + #if( $p.logged_in ) +   +#button( "IMAGE" "logout" ) + #end +
diff --git a/venice-data-sso/sp/velocity/sourceid/top.vm b/venice-data-sso/sp/velocity/sourceid/top.vm deleted file mode 100644 index c5bc734..0000000 --- a/venice-data-sso/sp/velocity/sourceid/top.vm +++ /dev/null @@ -1,59 +0,0 @@ -#* - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): -*# -#header1( "Temporary Top Page" ) -#if( $logged_in ) -

You are currently logged in.

-

This Service Provider can interact with the following Identity Providers:

- - - - - - - #foreach( $p in $provider_data ) - #set( $ep = "#encodeURL( $p.provider )" ) - - - - - - #end -
ProviderIDAuthenticated?Federated?
$p.provider - #if( $p.logged_in ) - Logged in at: #formatDate( $p.login_time ) - #if( $p.expire_time ) -
Session will expire at: #formatDate( $p.expire_time ) - #end -
- Click here to log out. - #else - Not logged in. - #end -
- #if( $p.federated ) - Federated.
- Click to terminate - federation. - #else - Not federated.
- Click to federate. - #end -
-#else -

User not logged in.

-#end diff --git a/venice-data/scripts/profile.js b/venice-data/scripts/profile.js index cfc8724..5adf65b 100644 --- a/venice-data/scripts/profile.js +++ b/venice-data/scripts/profile.js @@ -54,7 +54,8 @@ menu = mprov.getInlineMenu(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"user.pr if (menu.getItemCount()>1) { // set up the menu properly menu.setVariable("target",stringutils.encodeURL(target)); - menu.setSelectedIndex(0); + ndx = menu.getItemContainingLinkText("profile.js.vs"); + menu.setSelectedIndex(ndx); } // end if else // don't display the menu diff --git a/venice-web/images/buttons/classic/.gitignore b/venice-web/images/buttons/classic/.gitignore new file mode 100644 index 0000000..5c165d9 --- /dev/null +++ b/venice-web/images/buttons/classic/.gitignore @@ -0,0 +1 @@ +.xvpics diff --git a/venice-web/images/buttons/classic/federate.jpg b/venice-web/images/buttons/classic/federate.jpg new file mode 100644 index 0000000..fe068f7 Binary files /dev/null and b/venice-web/images/buttons/classic/federate.jpg differ diff --git a/venice-web/images/buttons/classic/logout.jpg b/venice-web/images/buttons/classic/logout.jpg new file mode 100644 index 0000000..05bd295 Binary files /dev/null and b/venice-web/images/buttons/classic/logout.jpg differ diff --git a/venice-web/images/buttons/classic/terminate.jpg b/venice-web/images/buttons/classic/terminate.jpg new file mode 100644 index 0000000..e4b7a4e Binary files /dev/null and b/venice-web/images/buttons/classic/terminate.jpg differ diff --git a/venice-web/images/buttons/gelcap/.gitignore b/venice-web/images/buttons/gelcap/.gitignore new file mode 100644 index 0000000..5c165d9 --- /dev/null +++ b/venice-web/images/buttons/gelcap/.gitignore @@ -0,0 +1 @@ +.xvpics diff --git a/venice-web/images/buttons/gelcap/federate.jpg b/venice-web/images/buttons/gelcap/federate.jpg new file mode 100644 index 0000000..516bc68 Binary files /dev/null and b/venice-web/images/buttons/gelcap/federate.jpg differ diff --git a/venice-web/images/buttons/gelcap/logout.jpg b/venice-web/images/buttons/gelcap/logout.jpg new file mode 100644 index 0000000..6d23838 Binary files /dev/null and b/venice-web/images/buttons/gelcap/logout.jpg differ diff --git a/venice-web/images/buttons/gelcap/terminate.jpg b/venice-web/images/buttons/gelcap/terminate.jpg new file mode 100644 index 0000000..b068a47 Binary files /dev/null and b/venice-web/images/buttons/gelcap/terminate.jpg differ