better-integrated the SSO Service Provider information by moving it onto a
Profile page
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
95
venice-data-sso/sp/scripts/sourceid/federations.js
Normal file
95
venice-data-sso/sp/scripts/sourceid/federations.js
Normal file
@@ -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 <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// 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 <erbo@silcom.com>,
|
||||
// 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
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user