During the last couple of months I’ve been working for the p&p guys at Microsoft, developing the sample application for a new guide around Windows Azure hybrid application integration.
One of the components of the sample solution is a console application that performs all the steps required to have the ACS and Service Bus namespaces properly configured. This application uses a set of wrappers around the ACS Management Service API.
While this is a great step towards simplifying the life of the developer, after I looked at the resulting code I realized that my life could have been simplified even more. That’s why I decided to spend some of my time developing a fluent API for setting up ACS namespaces.
This is how the API looks like:
var namespaceDesc = new AcsNamespaceDescription( "somenamespace", "ManagementClient", "T+bQtqP21BaCLO/8D1hanRdKJF8ZYEV8t32odxP4pYk="); var acsNamespace = new AcsNamespace(namespaceDesc); acsNamespace .AddGoogleIdentityProvider() .AddServiceIdentity( si => si .Name("Vandelay Industries") .Password("Passw0rd!")) .AddRelyingParty( rp => rp .Name("MyCoolWebsite") .RealmAddress("http://mycoolwebsite.com/") .ReplyAddress("http://mycoolwebsite.com/") .AllowGoogleIdentityProvider() .SwtToken() .TokenLifetime(120) .SymmetricKey( Convert.FromBase64String("yMryA5VQVmMwrtuiJBfyjMnAJwoT7//fCuM6NwaHjQ1=")) .AddRuleGroup(rg => rg .Name("Rule Group for MyCoolWebsite Relying Party") .AddRule( rule => rule .Description("Google Passthrough") .IfInputClaimIssuer().Is("Google") .AndInputClaimType().IsOfType(ClaimTypes.Email) .AndInputClaimValue().IsAny() .ThenOutputClaimType().ShouldBe(ClaimTypes.Name) .AndOutputClaimValue().ShouldPassthroughFirstInputClaimValue()) .AddRule( rule => rule .Description("ACS rule") .IfInputClaimIssuer().IsAcs() .AndInputClaimType().IsAny() .AndInputClaimValue().IsAny() .ThenOutputClaimType().ShouldPassthroughFirstInputClaimType() .AndOutputClaimValue().ShouldPassthroughFirstInputClaimValue()))); acsNamespace.SaveChanges(logInfo => Console.WriteLine(logInfo.Message));
You can find more information in the project repository at github.
Oh, and please don’t forget to take a look at the hybrid application integration guide when it becomes available (a draft can be downloaded from here), these guys have been doing an incredible job !
That’s it, I hope this helps