completed support for SourceID IDP, not tested yet
This commit is contained in:
244
venice-data-sso/idp/scripts/login.js
Normal file
244
venice-data-sso/idp/scripts/login.js
Normal file
@@ -0,0 +1,244 @@
|
||||
// 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):
|
||||
|
||||
importClass(Packages.org.sourceid.sso.util.ServletUtils);
|
||||
importPackage(Packages.org.sourceid.sso.xml.lib)
|
||||
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.dynamo.velocity.VelocityPage);
|
||||
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
|
||||
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");
|
||||
|
||||
// See if we're coming in as a result of an external authentication request.
|
||||
ar = sourceid.castAuthnRequestType(rhelp.getExternalSessionAttribute("org.sourceid.sso.authnRequest"));
|
||||
if (ar!=null)
|
||||
{ // prepare heading block
|
||||
heading = new VelocityPage("sourceid/login_heading.vm");
|
||||
heading.setParameter("provider",ar.getProviderID());
|
||||
if (ar.getFederate())
|
||||
heading.setParameter("federate",Boolean.TRUE);
|
||||
dlg.setUpperContentObject(heading);
|
||||
|
||||
} // end if
|
||||
|
||||
if (rhelp.isVerb("GET"))
|
||||
{ // just display the dialog and return
|
||||
dlg.setValue("tgt",target);
|
||||
vlib.setLocation(req,target);
|
||||
dynamo.scriptReturn(new FrameDialog(dlg));
|
||||
|
||||
} // 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
|
||||
|
||||
if (ar==null)
|
||||
{ // We logged in via a direct request, not via a Liberty SP asking us to. Set up the SourceID
|
||||
// session information.
|
||||
idpsess = sourceid.getIDPSession(req,true);
|
||||
rhelp.setExternalSessionAttribute(ServletUtils.SES_KEY_USER_ID,new_user);
|
||||
rhelp.setExternalSessionAttribute(ServletUtils.SES_KEY_AUTHN_METHOD,
|
||||
"urn:oasis:names:tc:SAML:1.0:am:password");
|
||||
|
||||
} // 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
|
||||
52
venice-data-sso/idp/scripts/logout.js
Normal file
52
venice-data-sso/idp/scripts/logout.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// 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(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importPackage(Packages.com.silverwrist.venice.session);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
|
||||
|
||||
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()))
|
||||
{ // dump the login cookie, if we have it set
|
||||
cctrl = cast.queryCookieControl(req);
|
||||
if (cctrl.isCookiePresent(venice_session.loginCookieName))
|
||||
{ // get rid of the cookie and its associated cookie authentication, lest it clutter the database
|
||||
source = session.getObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_COOKIE_AUTH_SOURCE);
|
||||
user.clearAuthenticationData(user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"cookie",source);
|
||||
cctrl.deleteCookie(venice_session.loginCookieName);
|
||||
|
||||
} // end if
|
||||
|
||||
session.invalidate(); // this dumps the entire session
|
||||
|
||||
// Now tell SourceID to log us out as well.
|
||||
rc = new ForwardToPath("/sso/logout");
|
||||
rc.setParameter("Return.Success","/top.js.vs");
|
||||
rc.setParameter("Return.Failure","/top.js.vs");
|
||||
dynamo.scriptReturn(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
dynamo.scriptOutput(new Redirect("SERVLET",target)); // bounce back to the target
|
||||
54
venice-data-sso/idp/scripts/sourceid/defederate.js
Normal file
54
venice-data-sso/idp/scripts/sourceid/defederate.js
Normal file
@@ -0,0 +1,54 @@
|
||||
// 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(java.lang);
|
||||
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);
|
||||
|
||||
// Make sure we're logged in.
|
||||
user = vlib.getUser(req);
|
||||
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 = req_help.getParameterString("p");
|
||||
if (provider==null)
|
||||
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","/" + return_URL);
|
||||
rc.setParameter("Return.Failure","/" + return_URL);
|
||||
dynamo.scriptReturn(rc);
|
||||
89
venice-data-sso/idp/scripts/sourceid/federations.js
Normal file
89
venice-data-sso/idp/scripts/sourceid/federations.js
Normal file
@@ -0,0 +1,89 @@
|
||||
// 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(java.lang);
|
||||
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
|
||||
|
||||
// Get the IDP session.
|
||||
idpsess = sourceid.getIDPSession(req,false);
|
||||
if (idpsess==null) // auto-logout if there's no IDP session
|
||||
dynamo.scriptReturn(new Redirect("SERVLET","logout.js.vs"));
|
||||
|
||||
// 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.getSPList().iterator();
|
||||
plist = new ArrayList();
|
||||
while (it.hasNext())
|
||||
{ // get each service provider in turn
|
||||
map = new HashMap();
|
||||
sp = sourceid.castSPDescriptorType(it.next());
|
||||
map.put("provider",sp.providerID);
|
||||
sentry = sourceid.getEntryForProvider(idpsess,sp.providerID);
|
||||
if (sentry!=null)
|
||||
map.put("auth",Boolean.TRUE);
|
||||
map.put("federated",cast.booleanObject(sourceid.isUserFederatedWith(req,sp.providerID)));
|
||||
plist.add(map);
|
||||
|
||||
} // end while
|
||||
|
||||
rc.setParameter("provider_data",plist);
|
||||
|
||||
dynamo.scriptOutput(rc); // all done
|
||||
20
venice-data-sso/idp/scripts/sourceid/idp_login.js
Normal file
20
venice-data-sso/idp/scripts/sourceid/idp_login.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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);
|
||||
|
||||
dynamo.scriptOutput(new Redirect("SERVLET","login.js.vs?tgt=sourceid/idp_return_login.js.vs"));
|
||||
69
venice-data-sso/idp/scripts/sourceid/idp_return_login.js
Normal file
69
venice-data-sso/idp/scripts/sourceid/idp_return_login.js
Normal file
@@ -0,0 +1,69 @@
|
||||
// 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.org.sourceid.sso.xml.lib)
|
||||
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.getSession(); // get the session
|
||||
user = vlib.getUser(session);
|
||||
|
||||
if (user.isAnonymous())
|
||||
{ // we did not authenticate - bail out
|
||||
ar = sourceid.castAuthnRequestType(rhelp.getExternalSessionAttribute("org.sourceid.sso.authnRequest"));
|
||||
if (ar==null)
|
||||
dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs"));
|
||||
else
|
||||
dynamo.scriptReturn(new ForwardToServlet("SourceID-SSO-Authenticator"));
|
||||
|
||||
} // end if
|
||||
|
||||
// Perform the Identity Provider Introduction Protocol, if it's configured. This involves forwarding to another
|
||||
// servlet, which will bounce to a common domain, set a cookie, and bounce back here.
|
||||
if (rhelp.getExternalAppAttribute("org.sourceid.sso.commonDomain")!=null)
|
||||
{ // only do this once...
|
||||
if (rhelp.getExternalSessionAttribute("org.sourceid.sso.IDPIntroductionDone")==null)
|
||||
{ // We need to construct the return path as an ABSOLUTE URL...
|
||||
rewriter = cast.queryURLRewriter(req);
|
||||
tmp = rewriter.rewriteURL("SERVLET","sourceid/idp_return_login.js.vs");
|
||||
url = "http://" + req.getServerName();
|
||||
if ((req.getServerPort()>0) && (req.getServerPort()!=80))
|
||||
url += (":" + req.getServerPort() + tmp);
|
||||
else
|
||||
url += tmp;
|
||||
rc = new ForwardToPath("/sso/idpiWriter");
|
||||
rc.setParameter("ReturnURL",url);
|
||||
dynamo.scriptReturn(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
rhelp.removeExternalSessionAttribute("org.sourceid.sso.IDPIntroductionDone");
|
||||
|
||||
} // end if
|
||||
|
||||
// If this wasn't the result of an external authentication request, leave.
|
||||
ar = sourceid.castAuthnRequestType(rhelp.getExternalSessionAttribute("org.sourceid.sso.authnRequest"));
|
||||
if (ar==null)
|
||||
dynamo.scriptReturn(new Redirect("SERVLET","top.js.vs"));
|
||||
|
||||
// Tell SourceID that we authenticated with this provider. Venice uses default password authentication, so
|
||||
// tell it that as well.
|
||||
rc = new ForwardToServlet("SourceID-SSO-Authenticator");
|
||||
rc.setParameter("UserID",user);
|
||||
rc.setParameter("AuthnMethod","urn:oasis:names:tc:SAML:1.0:am:password");
|
||||
dynamo.scriptOutput(rc);
|
||||
42
venice-data-sso/idp/scripts/sourceid/logout_render.js
Normal file
42
venice-data-sso/idp/scripts/sourceid/logout_render.js
Normal 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(java.util);
|
||||
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
|
||||
|
||||
// Resequence the Logout URL Map so it's more usable by Velocity.
|
||||
input_map = cast.toMap(rhelp.getChainParameter("Logout.URL.Map"));
|
||||
logout_list = new ArrayList(input_map.size());
|
||||
it = input_map.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{ // take each Map.Entry and make a new Map out of it
|
||||
ntry = cast.toMapEntry(it.next());
|
||||
tmp = new HashMap();
|
||||
tmp.put("id",ntry.getKey());
|
||||
tmp.put("url",ntry.getValue());
|
||||
logout_list.add(tmp);
|
||||
|
||||
} // end while
|
||||
|
||||
// Create the resulting view.
|
||||
rc = new VelocityView("Service Provider Logout","sourceid/logout_render.vm");
|
||||
rc.setParameter("logout",logout_list);
|
||||
rc.setParameter("nextURL",rhelp.getChainParameter("Return.Success"));
|
||||
dynamo.scriptOutput(rc);
|
||||
28
venice-data-sso/idp/scripts/sourceid/post_assertion.js
Normal file
28
venice-data-sso/idp/scripts/sourceid/post_assertion.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// 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);
|
||||
importClass(Packages.com.silverwrist.dynamo.velocity.VelocityPage);
|
||||
|
||||
req = bsf.lookupBean("request"); // get request
|
||||
rhelp = bsf.lookupBean("request_help"); // get request helper
|
||||
|
||||
// Create a simple template return value.
|
||||
rc = new VelocityPage("sourceid/post_assertion.vm");
|
||||
rc.setParameter("url",rhelp.getChainParameter("URL"));
|
||||
rc.setParameter("lares",rhelp.getChainParameter("LARES"));
|
||||
dynamo.scriptOutput(rc);
|
||||
64
venice-data-sso/idp/velocity/sourceid/federations.vm
Normal file
64
venice-data-sso/idp/velocity/sourceid/federations.vm
Normal file
@@ -0,0 +1,64 @@
|
||||
#*
|
||||
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):
|
||||
*#
|
||||
#*
|
||||
Parameters:
|
||||
menu = Menu to display along the top (may be null)
|
||||
target = Target page attribute.
|
||||
provider_data = List of information about individual providers.
|
||||
*#
|
||||
#set( $et = "#encodeURL( $target )" )
|
||||
#if( $menu )
|
||||
#render( $menu )
|
||||
#end
|
||||
#header1( "Identity Federations" )
|
||||
<p><b>This site can federate its identity to any of the following Service Providers:</b></p>
|
||||
<div align="center"><table border="1">
|
||||
<tr>
|
||||
<th class="content"><b>Provider ID</b></th>
|
||||
<th class="content"><b>Authenticated?</b></th>
|
||||
<th class="content"><b>Federated?</b></th>
|
||||
<th class="content"> </th>
|
||||
</tr>
|
||||
#foreach( $p in $provider_data )
|
||||
#set( $ep = "#encodeURL( $p.provider )" )
|
||||
<tr>
|
||||
<td>#encodeHTML( $p.provider )</td>
|
||||
<td>
|
||||
#if( $p.auth )
|
||||
<b>Yes</b>
|
||||
#else
|
||||
No
|
||||
#end
|
||||
</td>
|
||||
<td>
|
||||
#if( $p.federated )
|
||||
<b>Yes</b>
|
||||
#else
|
||||
No
|
||||
#end
|
||||
</td>
|
||||
<td>
|
||||
#if( $p.federated )
|
||||
<a href="#formatURL( "SERVLET" "sourceid/defederate.js.vs?p=$ep&tgt=$et" )">#button( "IMAGE" "terminate" )</a>
|
||||
#else
|
||||
(Visit the service provider's site to federate)
|
||||
#end
|
||||
</td>
|
||||
</tr>
|
||||
#end
|
||||
</table></div>
|
||||
29
venice-data-sso/idp/velocity/sourceid/login_heading.vm
Normal file
29
venice-data-sso/idp/velocity/sourceid/login_heading.vm
Normal file
@@ -0,0 +1,29 @@
|
||||
#*
|
||||
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):
|
||||
*#
|
||||
#*
|
||||
Parameters:
|
||||
provider = Name of provider that's asking us to log in.
|
||||
federate = True (set) if the IDP is federating with us.
|
||||
*#
|
||||
<p>You are being asked to log on to Venice as a Liberty Identity Provider (IDP) by the following Liberty Service
|
||||
Provider (SP): <b>#encodeHTML( $provider )</b>. After successfully logging on here, you will be redirected back to
|
||||
the Service Provider.</p>
|
||||
#if( $federate )
|
||||
<p>In addition, the Service Provider has asked this IDP to federate this account after the user is authenticated.
|
||||
This will happen automatically.</p>
|
||||
#end
|
||||
38
venice-data-sso/idp/velocity/sourceid/logout_render.vm
Normal file
38
venice-data-sso/idp/velocity/sourceid/logout_render.vm
Normal file
@@ -0,0 +1,38 @@
|
||||
#*
|
||||
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):
|
||||
*#
|
||||
#*
|
||||
Parameters:
|
||||
logout = List of ServiceProviders to log out, with IDs and URLs.
|
||||
nextURL = The next URL to move to.
|
||||
*#
|
||||
#header1( "Single Logout" )
|
||||
<p>When all the checkmark images below have finished loading, you will have been logged out of Venice, and also
|
||||
logged out of all the Service Providers listed below with whom you've recently authenticated.</p>
|
||||
<div align="center"><table border="1">
|
||||
<tr>
|
||||
<th><b>Provider ID</b></th>
|
||||
<th><b>Logged Out</b></th>
|
||||
</tr>
|
||||
#foreach( $p in $logout )
|
||||
<tr>
|
||||
<td>#encodeHTML( $p.id )</td>
|
||||
<td align="center"><img src="$p.url" width="32" height="32" border="0"></td>
|
||||
</tr>
|
||||
#end
|
||||
</table></div>
|
||||
<p>When all logouts are finished, <a href="$nextURL">click here</a>.</p>
|
||||
25
venice-data-sso/idp/velocity/sourceid/post_assertion.vm
Normal file
25
venice-data-sso/idp/velocity/sourceid/post_assertion.vm
Normal 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):
|
||||
*#
|
||||
#*
|
||||
Parameters:
|
||||
lares = LARES parameter to be posted bact to the URL
|
||||
url = URL parameter to be posted back
|
||||
*#
|
||||
<html><body onload="javascript:document.theForm.submit()">
|
||||
<form method="post" action="$url" name="theForm"><input type="hidden" name="LARES" value="$lares"></form>
|
||||
</body></html>
|
||||
@@ -10,7 +10,7 @@
|
||||
//
|
||||
// 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.
|
||||
// Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user