Sunday, June 8, 2008

Microsoft TechEd 2008: Oslo and WCF

This was the first time that I attended a Microsoft TechEd event. While the sessions were interesting, there was a lot of emphasis on WCF ( Windows Communication Foundation ), and understandably so I guess - its essentially a platform(WCF extensions) on a platform (.NET) and I say that because of the swooping changes that are brought to the .NET platform by adding the WCF implementation to it. At the core, WCF implements WS-* standards for web services, however there are very few vendors (if any other) that have implemented WS-* to this degree and simplicity. I think that right there should be a wakeup call for Java folks. I was pretty impressed with what I saw of WCF and look forward to playing with it.

Microsoft's codename "Oslo" project could also potentially be another knee-jerker for the Java camp. "Oslo" sounds interesting as a concept and is essentially a broad set of innovations touching many aspects of the application lifecycle, including languages, development tools, integration, application management, and more. The whole concept of "Oslo" is based around models. One would jump to the conclusion that this is Microsoft's MDD (Model Driven Design) methodology. However, its not really that. "Oslo" consists of 3 parts : Repository, Lifecycle manager, and schema language. The repository maintains the various model artifacts, and so models in the case of "Oslo" are anything in IT that has a representation through the schema and is maintained in the repository (eg. things like applications, computers, processes, services,SLAs). The schema extensions help to formalize definitions of basic entities (infrastructure and business based) in a software's life-cycle. What is really cool is the lifecycle manager uses the repository and the schema extensions to manage the entities represented. So for example, if a component is deployed on a certain platform/environment, on multiple machines, lifecycle manager will know about this profile and deploy the component accordingly onto the defined platform/environment.

All this occurs through sophisticated visual integration with tools like Visual Studio, Visio and Oslo's own visual editor - as a way to provide the same information to tools that people typically use in different roles ( analyst, developer etc). So Oslo really seems to me like a tool from the software development lifecycle perspective - modeling a component/service/process, building it, and then moving it and deploying it to an environment.

The key here is that there are so many bits and pieces to this colossal, that only a company like Microsoft could pull this feat through - the Open space world will probably have a hard time replicating such an effort and collaborate effectively. That would invariably give Microsoft a competitive edge. Another scary thought for the Java folks.

From what I saw at TechEd, Microsoft has some interesting technologies that have a lot of potential. C# as a language is evolving better and more rapidly than Java and so is the declarative language F# over something like Groovy on the Java side. In a services world too, WCF's ease of use and WS-* richness also place Microsoft very well in that space. "Oslo" still is a mystery, but if it comes close to what Microsoft is talking about, I think the Java space could find itself in troubled waters very soon :(.

Monday, May 12, 2008

A Single Sign-on implementation

If you are looking to implement a Single Signon implementation, then a worthwhile library to look at would be OpenSAML 2.0. The 2.0 library is well written and much more intuitive to use compared to its predecessor - OpenSAML 1.0. I recently implemented a SAML 1.1 solution using the 2.0 library on Weblogic 8.1. The library by default is for the Java 1.5 platform, however using Retroweaver, one can use it for Java 1.4 (since Weblogic 8.1 does not work with Java 1.5). The SAML Browser/Artifact profile is pretty easy to understand and implement with the library and good ol' Wikipedia gives an easy explanation of the steps needed to get the communication going. However, I would recommend that you read through the OASIS SAMLBind document to get a better understanding of implementation details.

I used Xfire (v1.2.6) to implement the Artifact Resolution Service at the IdP that the Service provider invokes once it receives the artifact posted to it. Since the OpenSAML library works with the raw xml document, one needs to configure xfire to prevent marshalling of the incoming xml to java POJOs. XFire has a cool way to work with raw xml documents, using a binding called as Message Binding. So the xfire service interface looks like:
public XMLStreamReader invoke(Document samlRequest) throws Exception
and the OpenSAML library can then work with the DOM document using the XMLObjectBuilderFactory request factory.

Some quirks here - while returning the response, I had to return an object of type XMLStreamReader - I used W3CDOMStreamReader to convert to this type. Also, for getting SOAP faults correctly, the interface definition of the service had to throw the base "Exception"class and not a specific exception type.

While the implementation does add a bit of added complexity through the use of XFire, it works out pretty well and allows one to use these excellent libraries -XFire & OpenSAML 2.0 - together to leverage the best of both.

The solution is on its way into production this week - fingers crossed....:).