| By Mark O'Neill | Article Rating: |
|
| March 6, 2013 01:54 PM EST | Reads: |
515 |
My use case is that I want to use OpenID for single-sign-on using a Google login. I found a nice implementation of OpenID called JOpenID and downloaded it as a jar file. I then placed the JOpenId-1.08.jar file into the /ext/lib folder of my API Server installation. I then placed this new class under /ext/lib on the API Server also, so that it will be picked up by the API Server runtime. Note that, for v7 onward, this must be placed under the /ext/lib instance you want to extend. You can find the correct instance by following the "groups" then "topologylinks" path under the API Server installation. This effectively puts it onto the classpath for that API Server instance.
JOpenID includes a class called OpenIdManager which has a method called getAuthenticationUrl that constructs the URL which directs the user to Google for SSO to a particular endpoint. I want to call that method from the API Server. However, from a Scripting Filter, I can only run a public static method of a class.
So, what I did was to make a class called "OpenIDEngine", and I gave it a public static method called "GetURL". In that method, I create an instance of OpenIdManager and I call OpenIdManager.getAuthenticationUrl to get the URL for me. This is what I will call from my Scripting Filter.
Here's the code I wrote:
package org.expressme.openid;
public class OpenIDEngine {
public static void main(String[] args) throws Exception {
System.out.println(GetURL("http://vordelapiserver/openId","http://vordelapiserver", "Google"));
}
public static String GetURL(String ReturnTo, String Realm, String Endpoint)
{
OpenIdManager manager = new OpenIdManager();
manager.setReturnTo(ReturnTo);
manager.setRealm(Realm);
manager.setTimeOut(10000);
Endpoint endpoint = manager.lookupEndpoint(Endpoint);
Association association = manager.lookupAssociation(endpoint);
String url = manager.getAuthenticationUrl(endpoint, association);
return url;
}
}
Read the original blog entry...
Published March 6, 2013 Reads 515
Copyright © 2013 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Mark O'Neill
Mark O'Neill is Chief Technology Office of Vordel. Vordel connects applications to applications, businesses to other businesses, and SOA to Cloud Computing. A regular speaker at industry conferences and a contributor to SOA World Magazine and Cloud Computing Journal, Mark holds a degree in mathematics and psychology from Trinity College Dublin and graduate qualifications in neural network programming from Oxford University.
- Cloud People: A Who's Who of Cloud Computing
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Cloud Expo New York: Delivering Digital Marketing on the Cloud
- Cloud Expo New York: Rethink IT and Reinvent Business with IBM SmartCloud
- Cloudant to Exhibit at Cloud Expo & Big Data Expo New York
- The Accessibility of the Cloud
- Learn How To Use Google Apps Script
- Cloud Expo NY: Best Practices for Delivering Oracle Database as a Service
- Cloud Expo New York: Basics of SSD Technology and Its Use in Cloud
- Session Topics: 12th Cloud Expo / Cloud Expo New York
- Cloud Expo New York: The Big Challenge of Big Data & Hadoop Integration
- Measuring the Business Value of Cloud Computing
- Cloud People: A Who's Who of Cloud Computing
- Cloud Expo New York: Best CIO Practices Shared from SHI’s Customers
- Cloud Expo New York: How to Use Google Apps Script
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Cloud Expo New York: Why Big Data Is Really About Small Data
- Cloud Expo New York: Delivering Digital Marketing on the Cloud
- Small Cancers, Big Data, and a Life Examined
- Cloud Expo New York: Requirements of a Cloud Database
- Cloud Expo New York: Rethink IT and Reinvent Business with IBM SmartCloud
- Cloudant to Exhibit at Cloud Expo & Big Data Expo New York
- The Accessibility of the Cloud
- Learn How To Use Google Apps Script
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- Where Are RIA Technologies Headed in 2008?



























