*** empty log message ***

This commit is contained in:
Eric J. Bowersox
2003-05-20 03:25:31 +00:00
commit b80fa05ed1
682 changed files with 85738 additions and 0 deletions

View File

@@ -0,0 +1,248 @@
// 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-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.org.sourceid.sso.xml);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importClass(Packages.com.silverwrist.dynamo.UserInfoNamespace);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.mail);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.content);
importPackage(Packages.com.silverwrist.venice.frame);
importPackage(Packages.com.silverwrist.venice.session);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
target = rhelp.getParameterString("tgt"); // get the target for this operation
if (target==null)
target = "top.js.vs";
vlib.setOnError(req,target);
session = rhelp.getSession(); // get the session
user = vlib.getUser(session);
if (!(user.isAnonymous())) // user already logged in, just bounce back to where we came from
dynamo.scriptReturn(new Redirect("SERVLET",target));
// Load the login dialog.
loader = cast.queryDialogLoader(req);
dlg = loader.loadDialogResource("login.dlg.xml");
if (rhelp.isVerb("GET"))
{ // just display the dialog and return
dlg.setValue("tgt",target);
vlib.setLocation(req,target);
// Get an error message that was left here by the SSO process, if any.
msg = null;
try
{ // get the message
msg = session.getObject("venice-sso:","failure.message") + "";
session.removeObject("venice-sso:","failure.message");
} // end try
catch (e)
{ // ObjectNotFoundException, presumably
msg = null;
} // end catch
if (msg!=null)
dlg.setErrorMessage(msg);
// Get the ProviderDirectory and the list of configured identity providers.
pdir = sourceid.getProviderDirectory(req);
idp_list = pdir.getIDPList();
// Create the return value.
rc = new VelocityView(vlib.dialogFrameTitle(dlg),"sourceid/login_dialog.vm");
rc.setParameter("loginDialog",dlg);
rc.setParameter("idpList",idp_list);
rc.setParameter("target",target);
dynamo.scriptReturn(rc);
} // end if
// everything that follows is for a POST operation
op = dlg.getClickedButton(req) + "";
if (op=="cancel") // user cancelled login - bounce back to the target
dynamo.scriptReturn(new Redirect("SERVLET",target));
dlg.load(req); // load dialog contents
if (op=="reminder")
{ // generate a password reminder
errmsg = null;
user = vlib.lookupUser(req,dlg.getValue("user"));
if (user!=null)
{ // user found...
if (user.isAnonymous()) // can't do this for the Anonymous_Honyak account
errmsg = "This account cannot be explicitly logged into. Please try again.";
else
{ // get the user's password reminder
reminder_msg = PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,
"password.reminder");
if (reminder_msg==null)
reminder_msg = "";
// generate and set authentication for the password recovery system
auth = vlib.randomRecoveryAuth() + "." + dynamo.currentTimeMillis();
user.setAuthenticationData(user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"password.recovery","",auth);
// create and send the reminder E-mail message
mailprov = cast.queryMailMessageProvider(req);
msg = mailprov.createSystemMessage(req);
msg.addRecipient(MailMessage.RECIP_TO,user.getEMailAddress());
globals = vcast.getGlobalPropertiesStore(req);
msg.setSubject(globals.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,
"reminder.message.title").toString());
blocks = vcast.getGlobalBlocksStore(req);
msg.setText(blocks.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,"reminder.message").toString());
msg.setVariable("username",user.getName());
msg.setVariable("reminder",reminder_msg);
msg.setVariable("uid",cast.toIntegerObject(user.getUID()));
msg.setVariable("auth",auth);
msg.send();
// set the error message and prepare the dialog for reset
errmsg = "Password reminder has been sent to the E-mail address for user '" + user.getName() + "'.";
dlg.setValue("pass",null);
} // end else
} // end if
else // user not found - bounce back with an error message
errmsg = "The user account you have specified does not exist. Please try again.";
if (errmsg!=null)
{ // set the error message and bounce back the dialog
dlg.setErrorMessage(errmsg);
dlg.setValue("user",null);
dlg.setValue("pass",null);
vlib.setLocation(req,target);
dynamo.scriptOutput(new FrameDialog(dlg));
} // end if
else // this ain't right
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown outcome from password reminder",
"SERVLET",target));
} // end if
else if (op=="login")
{ // attempt to log the user in!
errmsg = null;
new_user = vlib.lookupUser(req,dlg.getValue("user"));
if (new_user!=null)
{ // the user is present - we can do this
if (new_user.isAnonymous())
{ // can't log in as Anonymous_Honyak, foo!
errmsg = "This account cannot be explicitly logged into. Please try again.";
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Anonymous user");
dlg.setValue("user",null);
dlg.setValue("pass",null);
} // end if
else if (new_user.isLocked())
{ // account locked out - sorry!
errmsg = "This account has been locked out. Please contact the system administrator for assistance.";
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Locked Account");
dlg.setValue("pass",null);
} // end else if
else
{ // OK, we can try to authenticate with this account!
if (new_user.authenticate(UserInfoNamespace.NAMESPACE,UserInfoNamespace.AUTH_DEFAULT,"",
dlg.getValue("pass")))
{ // authenticated OK - set user into session
logger.debug("User \"" + new_user.getName() + "\" logged in successfully");
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER,new_user);
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.ok");
new_user.setLastAccessDate(new_user,new java.util.Date());
// Now set up this user's default objects.
dynamo.exec("/util/setup_user.js");
if (cast.toBoolean(dlg.getValue("saveme")))
{ // user wants a cookie - generate one
source = vlib.randomString(32);
auth = vlib.randomString(32);
try
{ // set the user authentication data
new_user.setAuthenticationData(new_user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"cookie",
source,auth);
// save the persistent cookie value
cval = "VQAT2:" + new_user.getUID() + ":" + source + ":" + auth;
cctrl = cast.queryCookieControl(req);
cctrl.putPersistentCookie(venice_session.loginCookieName,cval,venice_session.loginCookieAge);
// set the cookie authentication source so we can delete the auth info later at logout
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_COOKIE_AUTH_SOURCE,source);
} // end try
catch (e)
{ // ignore exception here
logger.warn("cookie setup process threw exception",e);
} // end catch
} // end if
// Has the user verified their E-mail address yet? If not, bounce them there.
if (PropertyUtils.hasProperty(new_user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number"))
dynamo.scriptReturn(new Redirect("SERVLET","verify_email.js.vs?tgt="
+ stringutils.encodeURL(target)));
else
dynamo.scriptReturn(new Redirect("SERVLET",target));
} // end if
else
{ // the password is wrong - please try again
errmsg = "The password specified for this user account is incorrect. Please try again.";
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad password");
dlg.setValue("pass",null);
} // end else
} // end else
} // end if
else
{ // user not found - bounce back with an error message
errmsg = "The user account you have specified does not exist. Please try again.";
audit.write(req,null,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad username",
dlg.getValue("user"));
dlg.setValue("user",null);
dlg.setValue("pass",null);
} // end else
if (errmsg!=null)
{ // set the error message and bounce back the dialog
dlg.setErrorMessage(errmsg);
vlib.setLocation(req,target);
dynamo.scriptOutput(new FrameDialog(dlg));
} // end if
else
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown outcome from login","SERVLET",target));
} // end else if
else
{ // unknown command button pressed!
logger.error("no known button click on POST to login.js");
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown command button pressed","SERVLET",target));
} // end else

View File

@@ -0,0 +1,40 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
session = rhelp.session;
// Make sure we're logged in.
user = vlib.getUser(session);
if (user.isAnonymous())
dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs"));
// Make sure a provider ID is provided.
provider = rhelp.getParameterString("provider");
if (provider==null)
dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs"));
// 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");
dynamo.scriptReturn(rc);

View File

@@ -0,0 +1,25 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importPackage(Packages.com.silverwrist.venice.content);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
ex = cast.toThrowable(rhelp.getChainParameter("javax.servlet.jsp.jspException"));
dynamo.scriptReturn(new ErrorBox("Captured SourceID Error",ex));

View File

@@ -0,0 +1,43 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
session = rhelp.session;
// Make sure we're logged in.
user = vlib.getUser(session);
if (user.isAnonymous())
dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs"));
// Make sure a provider ID is provided.
provider = rhelp.getParameterString("provider");
if (provider==null)
dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs"));
// Create an Authenticate + Federate request and send it off.
rc = new ForwardToPath("/sso/authnRequest");
rc.setParameter("ProviderID",provider);
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");
dynamo.scriptReturn(rc);

View File

@@ -0,0 +1,40 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
target = rhelp.getParameterString("tgt"); // get the target for this operation
if (target==null)
target = "top.js.vs";
vlib.setOnError(req,target);
// Save the target string where we can find it again when we land after validating the login..
sess = rhelp.session;
sess.setObject("venice-sso:","target",target);
// Get the provider ID and pass it to SourceID's applet.
p = rhelp.getParameterString("provider");
rc = new ForwardToPath("/sso/authnRequest");
rc.setParameter("ProviderID",p);
rc.setParameter("IsPassive",cast.booleanObject(false));
rc.setParameter("ForceAuthn",cast.booleanObject(false));
rc.setParameter("Federate",cast.booleanObject(false));
rc.setParameter("Return.Success","/sourceid/login_sso_ok.js.vs");
rc.setParameter("Return.Failure","/sourceid/login_sso_fail.js.vs");
dynamo.scriptReturn(rc);

View File

@@ -0,0 +1,34 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
// Retrieve the "target" string from the session.
session = rhelp.session;
target = session.getObject("venice-sso:","target") + "";
session.removeObject("venice-sso:","target");
// Retrieve the error parameter and build an error message to feed to the dialog box.
msg = rhelp.getChainParameter("Failure.Reason");
fullmsg = "SSO authentication failure: " + msg + ". Please try again.";
session.setObject("venice-sso:","failure.message",fullmsg);
// Now bounce back to the login dialog.
dynamo.scriptReturn(new Redirect("SERVLET","login.js.vs?tgt=" + stringutils.encodeURL(target)));

View File

@@ -0,0 +1,77 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importClass(Packages.com.silverwrist.dynamo.UserInfoNamespace);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.frame);
importPackage(Packages.com.silverwrist.venice.session);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
// Retrieve the "target" string from the session.
session = rhelp.session;
target = session.getObject("venice-sso:","target") + "";
session.removeObject("venice-sso:","target");
// The authenticated User ID (user object) is in the request attributes. It may be a proxy, so unwrap it.
auth_user = cast.queryDynamoUser(dynamo.unwrapObject(rhelp.getChainParameter("UserID")));
// There are some Dynamo-specific tests we need to make before we can be comfortable with logging in as
// this user. Do those now.
errmsg = null;
if (auth_user==null)
{ // user account not found
errmsg = "The user account you have specified does not exist. Please try again.";
audit.write(req,null,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad username");
} // end if
else if (auth_user.isAnonymous())
{ // can't log in as Anonymous_Honyak!
errmsg = "This account cannot be explicitly logged into. Please try again.";
audit.write(req,auth_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Anonymous user");
} // end if
else if (auth_user.isLocked())
{ // locked account - can't log in
errmsg = "This account has been locked out. Please contact the system administrator for assistance.";
audit.write(req,auth_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Locked Account");
} // end else if
if (errmsg!=null)
{ // send the error message back to the login dialog
session.setObject("venice-sso:","failure.message",errmsg);
dynamo.scriptReturn(new Redirect("SERVLET","login.js.vs?tgt=" + stringutils.encodeURL(target)));
} // end if
logger.debug("User \"" + auth_user.getName() + "\" logged in successfully");
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER,auth_user);
audit.write(req,auth_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.ok");
auth_user.setLastAccessDate(auth_user,new java.util.Date());
// Now set up this user's default objects.
dynamo.exec("/util/setup_user.js");
// Has the user verified their E-mail address yet? If not, bounce them there.
if (PropertyUtils.hasProperty(auth_user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number"))
dynamo.scriptReturn(new Redirect("SERVLET","verify_email.js.vs?tgt=" + stringutils.encodeURL(target)));
else
dynamo.scriptReturn(new Redirect("SERVLET",target));

View File

@@ -0,0 +1,42 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
session = rhelp.session;
// Make sure we're logged in.
user = vlib.getUser(session);
if (user.isAnonymous())
dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs"));
// Make sure a provider ID is provided.
provider = rhelp.getParameterString("provider");
if (provider==null)
dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs"));
// Log out locally first.
session.detach();
// Now log out remotely by going through SourceID.
rc = new ForwardToPath("/sso/logout");
rc.setParameter("ProviderID",provider);
rc.setParameter("Return.Success","/top.js.vs");
rc.setParameter("Return.Failure","/top.js.vs");
dynamo.scriptReturn(rc);

View File

@@ -0,0 +1,72 @@
// 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);

View File

@@ -0,0 +1,33 @@
#*
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
#renderDialog( $loginDialog )
<p />
#header1( "Login via Federated Identity" )
<p>If you have previously established an account here, AND you have previously federated it with one of
the following Identity Providers, then you may click on the appropriate Identity Provider link below.
You will be taken to the IDP's logon page, and returned here after authentication is complete.</p>
<p>Note that this WILL NOT work unless you have previously federated an account between this installation and
the Identity Provider. If you have not done this yet, then first create an account using the form above.</p>
<ul>
#set( $etgt = "#encodeURL( $target )" )
#foreach( $prov in $idpList )
#set( $arg = "#encodeURL( $prov.ProviderID )" )
<li><a href="#formatURL( "SERVLET" "sourceid/login_sso.js.vs?tgt=$etgt&provider=$arg" )">$prov.ProviderID</a></li>
#end
</ul>
<br />

View File

@@ -0,0 +1,59 @@
#*
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
#header1( "Temporary Top Page" )
#if( $logged_in )
<p>You are currently logged in.</p>
<p>This Service Provider can interact with the following Identity Providers:</p>
<table border="1">
<tr>
<td>ProviderID</td>
<td>Authenticated?</td>
<td>Federated?</td>
</tr>
#foreach( $p in $provider_data )
#set( $ep = "#encodeURL( $p.provider )" )
<tr>
<td>$p.provider</td>
<td>
#if( $p.logged_in )
Logged in at: #formatDate( $p.login_time )
#if( $p.expire_time )
<br />Session will expire at: #formatDate( $p.expire_time )
#end
<br />
<a href="#formatURL( "SERVLET" "sourceid/logout_sso.js.vs?provider=$ep" )">Click here to log out.</a>
#else
Not logged in.
#end
</td>
<td>
#if( $p.federated )
Federated.<br />
<a href="#formatURL( "SERVLET" "sourceid/defederate.js.vs?provider=$ep" )">Click to terminate
federation.</a>
#else
Not federated.<br />
<a href="#formatURL( "SERVLET" "sourceid/federate.js.vs?provider=$ep" )">Click to federate.</a>
#end
</td>
</tr>
#end
</table>
#else
<p>User not logged in.</p>
#end