73 lines
2.7 KiB
JavaScript
73 lines
2.7 KiB
JavaScript
// 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);
|
|
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);
|