From the monthly archives:
June 2005
Single Sign-On, The Java Way from XML.org Daily Newslink
Single Sign-On, The Java Way
by Clint Boulton, InternetNews.com from XML.org Daily Newslink
Sun Microsystems ratcheted up its identity management portfolio by offering two new products that help corporations extend secure access to outside partners and suppliers. Called Java System Federation Manager and Java System Identity Manager Service Provider Edition, the products allow customers to deploy ID management and user provisioning for applications and computer gear outside their intranets and firewalls. The idea is to allow partners access to specific sites without letting them run roughshod over the network, peeking at any data they desire. This is a major change from the traditional method of walling off networks to partners and customers. The software supports Security Assertions Markup Language (SAML), Liberty Identity Federation Framework, and Liberty Identity Web Services Framework standards, too. The tool can also integrate proprietary mechanisms, such as a Windows desktop. Identity Manager Service Provider Edition provides identity administration tools that make it easy for businesses to deploy applications and services from third-party partners. The product, which grants smooth data exchange in high-volume extranets, allows customers to replace less sophisticated and reliable identity management programs. The software can also automate the setup and management of federated accounts. Sun has crafted the new software to fill a market gap in terms of how partners were putting together federation on their side. Companies are creating too many one-to-one federated relationships instead of many-to-many exchange models.
More @ http://xml.coverpages.org/SunFederation200506.html
No tag for this post.Related posts
Interesting iBATIS Data Mapper issue
This is one of those issues where I'm not sure it's a feature or a bug. In iBATIS, you can use a parameterMap is to define an ordered list of parameters that match up with the value tokens passed along to your PreparedStatement. Here's a simple example from the doc:
[code lang="xml"]
insert into PRODUCT (PRD_ID, PRD_DESCRIPTION) values (?,?);
[/code]
So parameterMaps work great as you can create a Map instead of a concrete class to pass into the application. I typically use a JavaBean for parameters but will use Maps as a quick workaround for simple quick application. Today I discovered that you couldn't use parameterMaps if you are only passing in just1 parameter. If you try, you end up getting an SQLException with a 'Parameter index out of range' message.
Reading the doc seems to indicate that this is a feature as the doc reads:
If you are in a situation where it is not necessary or convenient to write a JavaBean class, and a single primitive type parameter won’t do (e.g. there are multiple parameters), you can use a Map (e.g. HashMap, TreeMap) as a parameter object.
So the clear implication is that you only want to use a Map if there are multiple parameters even though the doc doesn't clearly state that. Just thought it was interesting. I'm downloading the code as we speak – hope to figure out the real cause and maybe submit a patch or a Jira issue at the very least.
No tag for this post.Related posts
PayPal gets competition from Google
This is pretty interesting – Just read in the Wall Street Journal that Google is planning on offering an electronic-payment service that is probably fairly similar to eBay's PayPal. I guess the next step would be to offer listing service like eBay or CraigsList and take a serious bite out of eBay's revenues. EBay is a Wall Street darling and all attempts to mimic it have been met with mixed results. Amazon, Yahoo and others have tried to no avail and so it will be interesting to see if Google can beat eBay at its own game. So what's next – Google Bill Pay?
No tag for this post.Related posts
Interesting new book - Java Puzzlers: Traps, Pitfalls, and Corner Cases
Java Puzzlers: Traps, Pitfalls, and Corner Cases by Joshua Bloch, Neal Gafter
Paperback: 304 pages
Publisher: Addison-Wesley Professional (June 29, 2005)
ISBN: 032133678X
Just got an email from Addison-Wesley about the new/upcoming books and I found a new book by Josh Bloch and Neal Gafter. Here is a brief description of the book from the email:
How well do you really know Java? Are you a code sleuth? Have you ever spent days chasing a bug caused by a trap or pitfall in Java or its libraries? Do you like brainteasers? Then this is the book for you! Illustrated with a variety of engaging optical illusions, Java Puzzlers features 95 diabolical puzzles that educate and entertain. Anyone with a working knowledge of Java will understand the puzzles, but even the most seasoned veteran will find them challenging.
Tried ordering a copy on Amazon but it looks like this is one of the many books premiering at JavaOne.
No tag for this post.Related posts
An Introduction to Service-Oriented Architecture from a Java Developer Perspective by Debu Panda
An Introduction to Service-Oriented Architecture from a Java Developer Perspective by Debu Panda — Service-oriented architectures offer a new way to think about building software applications, with coarse-grained pieces of functionality split out into "services" that communicate with standardized, widely understood interfaces like XML and SOAP. In this article, Debu Panda shows you how to design and connect SOAs.
No tag for this post.Related posts
JCaptcha and NPR
Its funny how my mind works – I was listening to NPR's Weekend Edition over the weekend and they were going through listener's comments. At the end of that segment, they mentioned that they were not going to accept email comments to their old address. They want listeners to go to npr.org and fill out a web form to enter their comments. The first thought I had was spam – It had to be spam. Having an open email address that's published must get a ton of spam. I know I get a ton of spam daily and so I'm guessing NPR must have been getting thousands and thousands of spam messages.
So as I'm driving along, I started thinking about moving to the web-form model to solicit feedback and I just assumed that they would take the next logical step and add Captcha to their web app. If you don't know, Captcha (completely automated public Turing test to tell computers and humans apart) is an acronym for a type of challenge-response test to determine whether or not the user is human. Thinking about Captcha got me thinking about JCaptcha, an open-source Java framework for Captcha definition and integration. I knew about JCaptcha as I had read about it on Dion's blog a while back and so I finally decided to download and give JCaptcha a try.
I was impressed with how easy it was to incorporate Captcha into an existing application. Here is a simple web-app I built using the 5 minutes application integration tutorial on the JCaptcha wiki.
Here's the JSP that acts as an entry into the application:
[code lang="java"]
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
Sample JCaptcha
A captcha (an acronym for "completely automated public Turing
test to tell computers and humans apart") is a type of challenge-response
test used in computing to determine whether or not the user is human.
[/code]
To initialize the Captcha service, you create a singleton to instantiates an instance of the ImageCaptchaService that provides the facility to cache the Captcha and create the image.
[code lang="java"]
package com.j2eegeek.jcaptcha.common;
import com.octo.captcha.service.image.DefaultManageableImageCaptchaService;
import com.octo.captcha.service.image.ImageCaptchaService;
/**
* The CaptchaServiceSingleton implements the Singleton patterns and returns an instance of the
* ImageCaptchaService.
*/
public class CaptchaServiceSingleton {
private static ImageCaptchaService instance = new DefaultManageableImageCaptchaService();
public static ImageCaptchaService getInstance() {
return instance;
}
}
[/code]
Once we've created an instance of the ImageCaptchaService, we can create a servlet that will allow us to create an image. The servlet ends up calling the singleton to get an instance of the CaptchaService Singleton and calling its getChallenge() method.
[code lang="java"]
/**
* The ImageCaptchaServlet class creates the actual image that's displayed to the user for validation.
* The servlet ends up calling the singelton to get an instance of the CaptchaService Singleton and calling its
* getChallenge method.
*/
public class ImageCaptchaServlet extends J2EEGeekBaseServlet {
private static final Log log = LogFactory.getLog(ImageCaptchaServlet.class);
public void doWork(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
byte[] captchaChallengeAsJpeg = null;
// the output stream to render the captcha image as jpeg into
ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream();
try {
// get the session id that will identify the generated captcha.
String captchaId = req.getSession().getId();
// call the ImageCaptchaService getChallenge method
BufferedImage challenge = CaptchaServiceSingleton.getInstance().getImageChallengeForID(captchaId, req.getLocale());
// a jpeg encoder
JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(jpegOutputStream);
jpegEncoder.encode(challenge);
} catch (IllegalArgumentException e) {
log.error("IllegalArgumentException exception - " + e.getCause().getMessage());
res.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
} catch (CaptchaServiceException e) {
log.error("CaptchaServiceException exception - " + e.getCause().getMessage());
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
captchaChallengeAsJpeg = jpegOutputStream.toByteArray();
// flush it in the response
res.setHeader("Cache-Control", "no-store");
res.setHeader("Pragma", "no-cache");
res.setDateHeader("Expires", 0);
res.setContentType("image/jpeg");
ServletOutputStream out = res.getOutputStream();
out.write(captchaChallengeAsJpeg);
out.flush();
out.close();
}
}
[/code]
Once you've created the image and displayed it via the index.jsp page, you need to validate the response entered by the user.
[code lang="java"]
public class ValidateServlet extends J2EEGeekBaseServlet {
private static final Log log = LogFactory.getLog(ValidateServlet.class);
public void doWork(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html");
ServletOutputStream out = res.getOutputStream();
out.println("
Boolean isResponseCorrect = Boolean.FALSE;
String captchaId = req.getSession().getId();
String response = req.getParameter("j_captcha_response");
try {
isResponseCorrect = CaptchaServiceSingleton.getInstance().validateResponseForID(captchaId, response);
} catch (CaptchaServiceException e) {
log.error("Exception - " + e.getCause().getMessage());
}
if (isResponseCorrect.booleanValue()) {
out.println("
Success — Try again?
");
} else {
out.println("
Failure — Try again");
}
}
}
[/code]
Here's all the code that's essentially a rip-off from the wiki as a IDEA project. Another great resource is the JavaWorld article that Dion points to written by Anand Raman. He goes into details about incorporating Captcha into JAAS.
No tag for this post.Related posts
MAC OS for Wintel Machines?
Looks like what started out as a rumor might actually turn out to be true – C|Net is reporting that Apple Computer plans to announce Monday that it's scrapping its partnership with IBM and switching its computers to Intel's microprocessors. This is quite a shift for Apple but nothing new given their history of not worrying about backwards compatibility.
Now why would Apple want to switch to Intel chips? Would Apple actually sell their OS to the masses without their proprietary hardware? Could you just deploy the MAC OS on any vanilla Wintel machine? If that is their intention, it could potentially open up a huge market and revenue stream for Apple. It's interesting to look at a company like Microsoft who makes all of their money on software, running on commodity hardware. Hardware companies have had a much harder in the past 2 decades and so Apple could actually grow if they start thinking of themselves as a software company. I wonder what Microsoft thinks about this – Linux on the desktop for the masses has never been a viable option. I've been a Linux user since the early 90's but I've relegated my Linux boxes to the server role. If MAC OS was generally available for any Intel based machine, Windows would finally have some real competition for the desktop.
The article goes on to say that the higher-end Mac's would be running Intel chips in mid-2007, which is right around when Longhorn will probably ship. I guess this could end up being a great OS battle. The latest OS from Microsoft vs. the latest OS from Apple – I don't know how will win or even what will happen but I think consumers will win in the end because Microsoft will finally had to start innovating. Microsoft will have real competition in the OS market and they know that if you lose the OS market, you're going to lose the desktop and that usually means 'game over'. It's like the old Chinese proverb – "May you live in interesting times".
Of course this is all supposition as Apple could just be happy with the market share it currently has and the move to Intel could just something internal. But it seems like that this architecture change is pretty radical and there has to be something more to it.
No tag for this post.