Archives

Showing posts with label Cloud. Show all posts
Showing posts with label Cloud. Show all posts

Friday, June 17, 2011

Starbucks Announces Release of "Official" Android App

 

NewImage.png
The age of a "cashless society" is upon us.  Of course, maybe it's just a "walletless society", but nonetheless there seems to be fewer and fewer reasons to actually carry cash or a checkbook these days.
I remember being in the Salt Lake City airport shortly after the 2000 Olympics and i saw the vending machines all had Ethernet connections & you could swipe a credit card in them.  Obviously this was a necessity when you got tons of travelers coming through that don't have US Currency (possibly not even speaking English) and still want a Coke.  Being able to swipe & go was a tremendous service to offer these visiting travelers, not to mention a (most likely) cash cow for the vending machine companies.  Heck, I bought a Coke from one of the machines just because I wanted to say I'd done it.  It's not always inexpensive being a traveling geek!
Anyway, now with credit & debit cards a lot of folks really aren't carrying much cash these days.  I personally can't remember the last time I carried a check book either.  Well, this is all taking an even more techie turn as smart phones get into the fray of this as well.  As an example, let's take a look at my favorite coffee company, Starbucks.  One of the neat marketing things Starbucks does is the concept of your "own" coffee card.  Someone can give you one or you can get one for yourself.  It's  a gift card that can then be registered to a certain user (you) and then reloaded with cash whenever the balance gets low.  By having a card tied to you by registering it through the Starbucks website, the owner's coffee habits can be tracked and Starbucks assigns "points" for purchases.  It's a great way for the company to ensure loyalty and the consumer gets some perks as well.
In January, the company released an App through the Apple App Store that allowed the consumer to put in their Starbucks Card number and then use the app to charge/pay for the purchases... even if the buyer didn't have their card with them.  This made Starbucks truly cashless.  It also meant that more and more  people began locking themselves into a card since they could reload it at their leisure and didn't have to worry about having cash or their card with them.
The bummer part of the deal came when no Android App showed up.  Trust me when I say, "Geeks drink coffee."  i know of what I speak.  Geeks also use phones other than those made by Apple.   So, anyway today Starbucks announced that they have an Android App that mimics what iPhone users have had for 6 months now.
However, you don't have to use this new app if you don't want to.  Because there was a need and no solution by Starbucks, an app called My Coffee Card.  This amazing and FREE app allows you to charge your purchases by creating an onscreen barcode that can be scanned by the cash register.  It also tracks your spending and stores your receipts.  This receipt/account function is so fast that I can pay for my coffee using the app, check my balance, and have the updated/current balance on the screen before my coffee is in my hand.  You can also use it to reload your card using a secure connection where you simply punch in your credit card number and then tell it how much you want to put on the card.  Heck, it even has a Starbucks locator for those of us who travel.
I've been using My Coffee Card since the early part of 2011 and I can't say enough good things about it.  In fact, it does such a great job, I'm not quite sure why Starbucks bothered to bring out an app after 6 months of not having one.
Now just to be fair, I did download the "official" Starbucks app today and I'm going to give it a try, but honestly it's going to have to really sweep me off my feet to get me to give up my beloved My Coffee Card.

 

Read More >>

Sunday, June 12, 2011

Testing Applications that use the AppFabric Caching Service in the Compute Emulator

One of the recent additions to the set of cloud services available as part of the Windows Azure Platform is the AppFabric Caching Service, and one of the interesting features of the AppFabric Caching Service is an ASP.NET session state provider. This is interesting because it offers a web-farm friendly session state provider, so if you deploy multiple instances of your Windows Azure web role, you now have a working, out-of-the-box, production quality session state provider (previously, if you deployed multiple instances, you had to implement your own, web-farm aware session management in your web role).

Using the AppFabric Caching Service session state provider in your Windows Azure application is simple. First, you need to set up a cache namespace using the Windows Azure portal:

CacheNamespace

Second, you must modify your application’s Web.config file with the necessary configuration to point to your new cache. This is easy to do, because you can copy and paste the necessary XML from the portal — just click on the View Client Configuration button:

ClientConfig

That’s it, no code changes are necessary for your application.

Once you’ve created your cache and updated your Web.config file, you’ll want to test it out. Probably, you’ll want to initially test it out using the local Compute Emulator rather than deploying your application to Windows Azure — so make sure that you configure two or more instances of your web role, and try it out. Unfortunately, you’ll find that it doesn’t work: when the local Compute Emulator switches to another instance, your session state disappears (and reappears if you are switched back to the original instance). It may help to display the current instance id somewhere in your UI to keep track of what’s happening, for example:

Instance: <%=RoleEnvironment.CurrentRoleInstance.Id  %>

It turns out that that the problem lies with the local Compute Emulator and the default settings for the session state provider. By default, the session state provider uses the value of HttpRuntime.AppDomainAppId when it builds its cache keys, and each instance in the local Compute Emulator has a unique value. If you add an additional attribute, applicationName, to your configuration, the session state provider uses this value instead of the value of HttpRuntime.AppDomainAppId and now everything works as it should:

<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
   <providers>
      <add name="AppFabricCacheSessionStoreProvider"
          type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
          cacheName="default"
          applicationName="MyAppName"
          useBlobMode="true"
          dataCacheClientName="default" />
   </providers>
</sessionState>

This problem only manifests itself in the local Compute Emulator, you don’t need to use the applicationName attribute when you deploy your application to Windows Azure, although it doesn’t do any harm if it is there.

Read More >>

Tuesday, June 7, 2011

Apple Announces OS X Lion & Shows How the Internet has Changed Things

OS X Lion Logo Small.png
Today at the World Wide Developer Conference in San Francisco, Apple announced that the next version of their OS X operating system, named Lion in keeping with the cat theme, will be available in July.  The update will set you back $29.99 US and will be found in the online App Store.  Now I'm a Mac guy (although Windows runs my office by keeping Eaglesoft as the center of my dental practice universe) so I'm always excited when a new Mac version arrives.  However, this time something in the announcement got me to thinking about days past...
In the early days of the Internet & computing, I lived in a Windows world exclusively and I was beyond pumped for the release of Windows 95.  On the day it was released, August 24, 1995 I was one of those die hard geeks that waited in line to get my hands on a copy of the new Windows operating system.  When I got home & opened the box, I was greeted by a stack of 3.5 inch floppy disks.  In fact, the installation required 13 of those disks.  Of course, this was because the CD drive was almost unheard of back then.  Most computers did not have a CD-ROM drive, but every one of them had a floppy drive.
Fast forward to Windows 98.  Suddenly, in just 3 years the computing world had gone from floppies to CD's.  This made the install much faster & much easier.  Suddenly it seemed like any type of software came on a CD.  OS updates continued to arrive on optical disks for years.  My last Mac update, Snow Leopard, was installed from a DVD.
So what does this have to do with today & the announcement of LIon's availability next month?  Well, listen to this... Apple will not be distributing this software on a DVD.  No, Lion will be available only by download from the App Store. That's right, there will be no "boxed" version of the software.  The 4GB update will only be available over the Internet.
What does this mean?  Welcome to The Cloud.  It means that broadband proliferation has become so mainstream there is no reason to sell DVD's.
If you can't even buy your computer's operating system on a disc, what does that say for the future of movies, music, etc?  Why did Apple also announce their iCloud service to compete with Amazon's Cloud Player?  The rules just changed.  The network is now at least as important as the computer.  It's a web based world.

Read More >>

Wednesday, June 1, 2011

iCloud is Coming!

iCloud.jpg
Every June for the last few years, Apple has announced the latest iPhone.  This year, that won't be the case as it looks like the iPhone 5 announcement won't come until late summer at the earliest.
So... in order to stop speculation on next weeks announcement at the World Wide Developers Conference, Apple did something today that they don't normally do... namely the told, in advance, what one of the big announcements will be.
It's iCloud, Apple's online music repository.  About 2 years ago, Apple bought online music service LaLa and promptly shut it down.  Since then there has been speculation about a cloud type service for iTunes customers.  Now we've already seen a service like that from Amazon and one has been rumored by Google.
Apple is mum on exactly what the service will do, preferring instead to let people speculate and let the drama build until next week.  Knowing Jobs & company, it will be a better service than what Amazon is already offering (Apple hates to be a me to company), so I'm intrigued to see what this means for my music...

Read More >>

Monday, April 11, 2011

Microsoft Cloud Talk. Spain

Hello everyone

I would like to share this Spanish Link

 

http://www.microsoft.com/spain/cloudtalk/expertos.aspx

image

 

We are speaking about Cloud.

Answering questions

Webcasting

Podcasting

Inteviews

and so on

Regards

sAnTos

Read More >>

Tuesday, October 5, 2010

Evernote can now Link to Searches if you use Google Chrome




I love Evernote and have been using it for a couple of years now. It's a great way to keep track of things and keep them where you can easily get to them.

The Evernote idea is an easy one. You create notebooks, say Travel, that hold notes. Each note in the Travel notebook could be all the info for upcoming trips. You can access this info over the Net, store it locally on your PC or Mac & sync it to the web, access it on your phone, iPad, iPod Touch, etc. All your miscellaneous info can be found in one place... The Cloud.

Now you can install a Google Chrome extension that eve searches Evernote when you search via Chrome. Slick!

For all the details on Evernote & how to get it working with Chrome, take a look at this Evernote blog entry.

- Posted using BlogPress from my iPad
Read More >>

Monday, July 13, 2009

CardSpace and the Access Control Service

The Geneva Framework is designed to simplify the development of claims-aware applications that want to eternalize the authentication function. I wanted to the the Geneva Framework to help create an ASP.NET application that would enable users to authenticate with either a Windows Live ID or a CardSpace managed information card, and then apply some authorization rules that were defined in the Access Control Service (one of the cloud hosted .NET Services).

My initial working assumptions were:

1. The Windows Live ID authentication would use a passive mechanism (WS-Federation). My ASP.NET application (the Relying Party) would send an HTTP request to an Access Control Service (ACS) endpoint, which would then initiate a sequence of HTTP redirects to authenticate the user at www.live.com, and then deliver a set of authorization rules (claims) from ACS back to my application.

2. The CardSpace authentication would use an active mechanism (WS-Trust). The ASP.NET application would launch the CardSpace UI to enable the user to select a suitable card, which would then be delivered directly to ACS in a SOAP message. ACS would then examine the claims in the card and deliver a set of authorization rules (claims) from ACS back to my application.

Assumption 1 turned out to be valid, and easy to implement as there are plenty of available examples to work from. The only bit which is not perfect here is managing the sign out from Windows Live whilst remaining on a page of my ASP.NET application.

Assumption 2 however turned out to be problematic. The current version of CardSpace (a part of .NET Framework 3.5) will only work with a Security Token Service (STS) that returns at least 1 claim. Unfortunately the endpoint that ACS exposes has an associated policy that does not have any required claims – so CardSpace refuses to talk to it. The Geneva Framework includes a new (beta) version of Windows CardSpace which relaxes this restriction, but I then hit another obstacle: the ACS uses message security, but the new version of CardSpace currently only supports mixed-mode transport bindings. So again CardSpace will not talk to the ACS.

As a work around I reverted to using a passive approach for the CardSpace authentication. My ASP.NET website (the Relying Party) is configured to perform a passive logon to the ACS, but instead of the ACS redirecting to a Windows Live login page, it redirects to a login page on a custom STS (created using a template from the Geneva Framework). This custom STS operates as a proxy, and extracts the claims from the Information Card, before repackaging them as a new set of claims to send to the ACS in an HTTP redirect.

Hopefully, this will all be simplified in future releases of CardSpace and the ACS, when a direct login to the ACS using a managed card will be possible.

For anyone who’s interested I’ve posted some sample code and documentation here:

Read More >>

Monday, June 1, 2009

LiveID, authentication and the cloud

I would imagine that by now, most people who use Windows (and other operating systems), would have signed up for a LiveID. This is the mechanism that Microsoft use just about everywhere they need to authenticate users on the web. You may have noticed that LiveID accounts can be used on non-Microsoft sites as well.

In this post I wanted to summarize some of the scenarios for using LiveID, and illustrate its usefulness as an authentication mechanism.

  • From a user’s perspective, having to remember a single id and password for a whole lot of sites is convenient. Sometimes a user even **appears** not to have to log in at all, because their credentials are remembered for them.
  • From a developer’s, having someone else look after the authentication process can dramatically simplify an application.

The scenarios I’d like to outline are:

  1. Logging in directly to a LiveID enabled application. Examples include Windows Live Messenger, or Live Mesh.
  2. Using delegated authentication. Your application needs to use a resource in another LiveID enabled application.
  3. Using persistent delegated authentication. Your application needs to use a resource in another LiveID enabled application, but you don’t want to keep asking the user for their credentials.
  4. Using LiveID as the authentication mechanism for your application.
  5. Using a LiveID to authenticate against an OpenID enabled application.

I’m sure there are plenty of other scenarios, but these 5 strike me as the most interesting and useful in practice.

Scenario 1 - Logging in directly to a LiveID enabled application

The most trivial version of this (from a user’s point of view) is logging in to an application like Windows Live Messenger or a protected page somewhere on microsoft.com. Once the user has registered for a LiveID, they can log in anywhere they see the LiveID login logo.

A slightly more complex version of this scenario (for a developer) would be logging in from within a web application.

var accessOptions = new LiveItemAccessOptions(true);
NetworkCredential credentials = new NetworkCredential(userName, password);
LiveOperatingEnvironment endpoint = new LiveOperatingEnvironment();
var authToken = credentials.GetWindowsLiveAuthenticationToken();
endpoint.Connect(authToken, AuthenticationTokenType.UserToken, meshCloudUri, accessOptions);
Mesh meshSession = endpoint.Mesh;
HttpContext.Current.Session["MeshSession"] = meshSession;

The code above logs a user on to the Live Mesh Operating Environment, using the id and password provided by the user. Presumably here, the endpoint looks after the authentication process for you. After that the web application is caching the authenticated Mesh object for the duration of the user’s session.

The significant feature of this scenario, is that all the interaction with LiveID is handled by someone else – in this case the Mesh Live Operating Environment.

Scenario 2 - Using delegated authentication

This scenario differs from the first in that your application needs to authenticate with LiveID **before** accessing a resource. For example, you might have a web application that enables a user to send and receive instant messages from within the application. In this case your application will have to log in to Windows Live Messenger on behalf of the user, hence delegation. You also want the user to have to provide their credentials once per session, so they don’t keep getting prompted to sign in!

Assuming the user already has a LiveID, this scenario breaks down into two major steps:

  1. The user must give their consent for your application to access their Live Messenger account. Ideally this happens only one, or at least infrequently (once a month?).
  2. The user logs in at the start of their session, and your application can then send and receive instant messages for them during the session.

The consent phase

Here the user is giving consent for this **specific** application to have permissions to access their Live Messenger account for some period of time.

  1. Your application must be able to uniquely identify itself – so you must register your application on the Azure Services Developer Portal and get some identifying codes.
  2. Your application must redirect the user to the LiveID consent webpage (passing your app’s unique identifying codes) to allow the user to give their consent.
  3. Your user will be automatically redirected back to your application after giving consent. Also, LiveId will return a consent token (see below) in a cookie to your application.

All of these interactions are, of course, encrypted.

The user uses your application

This is where the delegation occurs – your application can use Live Messenger on behalf of the user.

  1. Once the user has authenticated using LiveID, the LiveID servers return an encrypted cookie called a consent token (if the user doesn’t already have one from the consent phase). This consent token contains, amongst other items, a delegation token and some expiry details. The consent token is potentially a long-lived token (there is also a renewal/refresh mechanism that I won’t go into here).
  2. From this point on, whenever your application needs to interact with Live Messenger, it will send the signed delegation token back to the server.

Once the user logs off, the two tokens are lost, so when they go back to the site they’ll have to log in again and get a new consent token. To avoid replay attacks, the delegation token is signed and datetime stamped.

Scenario 3 – Using persistent delegated authentication

This scenario is very similar to scenario 2. In scenario 2, each time the user uses your application, they have to sign on again to get access (in this example) to the messenger functionality. If your application can cache the consent token, perhaps in a database, then there is no need for the user to have to log on because the delegation token can be re-signed and sent. The only time the user might have to sign on again is to refresh the consent token when it expires.

This approach leads to a much better user experience, but you do have to have a secure way of storing the consent tokens.

Scenario 4 - Using LiveID as the authentication mechanism for your application

The first three scenarios are all using a LiveId as way of authenticating against an existing (Microsoft) application or resource. There is nothing to prevent you from using LiveId as your own application’s authentication mechanism. This has a number of advantages:

  1. You don’t have to go through the hassle of designing your own authentication system, and implementing databases to store userids and passwords etc.
  2. The user doesn’t have to remember yet another userid and password.
  3. You have a a tried and tested authentication scheme.

This scenario is again, very similar to scenario 2. You need to register your application on the Azure Services Developer Portal and obtain your unique identifying codes. The Live SDK includes a set of web controls that will simplify the task of building your UI and handling the various tokens and cookies.

Scenario 5 - Using a LiveID to authenticate against an OpenID enabled application

OpenId is an interesting approach to try and provide a framework where a user might need just one online digital identity, instead of the dozens of userids and passwords most of us currently have.

An OpenId provider enables users to create a digital identitiy (ie create a userid and password). The OpenId provider also validates identities on behalf of other sites. So, for example, if I want to use a site like Stackoverflow, I will need an OpenId. When I visit Stackoverflow, it needs to know who I am, so it asks me for an OpenId. I am then redirected to my OpenId provider where I enter my password, and if it’s correct I’m redirected back to Stackoverflow. Stackoverflow knows who I am, without even having to see my password because it trusts the OpenId provider to authenticate me.

Microsoft currently have a beta version of LiveId working as an OpenId provider. So, if you want your digital identity to be your LiveId, that’s now possible. Of course your could select a different OpenId provider if you preferred.

Read More >>

Tuesday, February 10, 2009

The Service Bus

The Service Bus is one of the three .NET services available as part of Azure Services platform. At first sight there seemed to be a slightly daunting array of options for using the Service Bus, so here is a first attempt to try and pull the most significant elements together (with some notes after the table). For more detail check the original documentation which can be found here.

Service Bus Bindings (1)

.NET 3.5 WCF Equivalent Binding (2)

Optional HTTP connectivity mode (3)

Multicast Event Distribution

One-way Binding

Default Settings

Uri Scheme (8)

Client (Sender)

Channels

Service

(Listener) Channels

Data Channel Protection

SecurityMode options

Client and Service Authentication (6)

Reliable Messaging

BasicHttpRelayBinding

BasicHttpBinding

 

 

 

SOAP 1.1

WS-I Basic profile 1.1

http

https

80

443

Pair of secure socket connections to the cloud listener (5)

Transport

TransportWithMessageCredential

Yes

 

No

NetEventRelayBinding

N/A

Yes

Yes

N publishers

M listeners

Yes

SOAP 1.2 over TCP

.NET Framing

.NET Binary Serialization

sb

808

or

828 SSL

828 SSL

or

HTTP

(3)

Transport

TransportWithMessageCredential

Yes

No

NetOnewayRelayBinding

N/A

Yes

 

Yes

SOAP 1.2 over TCP

.NET Framing

.NET Binary Serialization

sb

808

or

828 SSL

 

828 SSL

or

HTTP

(3)

Transport

TransportWithMessageCredential

Yes

No?

NetTcpRelayBinding

NetTcpBinding

 

 

 

SOAP 1.2 over TCP

.NET Framing

.NET Binary Serialization

sb

SSL protected only in Relayed mode (7)

Choice of connectivity modes: Relay, Hybrid, Direct (9)

SSL protected only in Relayed mode (7)

Choice of connectivity modes: Relay, Hybrid, Direct (9)

Transport

TransportWithMessageCredential

Yes

Yes

(CTP version doesn't support this for Hybrid and Direct)

WebHttpRelayBinding

WebHttpBinding

 

 

 

Plain HTTP messages

Support for XML and Raw (binary) message encodings - supports REST

http

https

80

443

Pair of secure socket connections to the cloud listener (5)

Transport

Yes

No

WS2007HttpRelayBinding

WS2007HttpBinding

 

 

 

SOAP 1.2

Latest OASIS standards for Reliable Message Exchange and Security

http

https

80

443

Pair of secure socket connections to the cloud listener (5)

Transport

TransportWithMessageCredential

Yes

Yes

WSHttpRelayBinding

WSHttpBinding

 

 

 

SOAP 1.2

Draft WS-* standards for Reliable Message Exchange and Security as available at release of WCF 3.0

http

https

80

443

Pair of secure socket connections to the cloud listener (5)

Transport

TransportWithMessageCredential

Yes

Yes

Service Bus Bindings (1)

These are currently the available bindings in the .NET Services December 2008 CTP. Recommended binding is NetTcpRelayBinding.

.NET 3.5 WCF Equivalent Binding (2)

For the most part the 'Relay' bindings work in the same way as their standard WCF counterparts, except that the listeners are created in the cloud.

Optional HTTP connectivity mode (3)

Features the ability for a receiver to operate using just ports 80 and 443 if connectivity is locked right down. It implements a polling system to check for new messages.

ConnectivityMode

  • ConnectivityMode.Tcp: In this mode, all one-way and event communication is relayed over outbound TCP ports 828 and 808. SSL-secured traffic uses port 828, while unsecured traffic uses port 808.
  • ConnectivityMode.Http: In this mode, all one-way and event communication is relayed over outbound ports 80 and 443 using HTTP or HTTPS. This mode is the backup communication option for environments where outbound communication is constrained to HTTP/HTTPS, where outbound ports 808 and 828 are not available, or where the service/client cannot resolve external DNS names.
  • ConnectivityMode.AutoDetect: This mode automatically selects between the ConnectivityMode.Tcp and ConnectivityMode.Http, and favors TCP if it is available.

Listener Connection (5)

The SSL-protected control channel is using outbound TCP port 828, and the data channel is using outbound port 818. The data channel is SSL-protected if the endpoint URI scheme is "https" and the Security.Mode property is set to one of the EndToEndBasicHttpSecurityMode values Transport or TransportWithMessageCredential.

Security.Transport.RelayClientAuthenticationType (6)

This property controls whether clients of a service are required to present a security token issued by the Access Control service to the Service Bus service when sending messages. Services (listeners) are always required to authenticate with the Access Control service and present an authorization token to the Service Bus. If the service (listener) wants to take over the responsibility of authenticating/authorizing clients, it can opt out of the integration between Access Control and Service Bus by setting this property to RelayClientAuthenticationType.None. The default value is RelayClientAuthenticationType.RelayAccessToken.

Transport Channel Protection (7)

The transport channel protection guards all traffic to and from the Relay, but the data is visible to (but not observed by) the Service Bus infrastructure at the socket relay point. You can employ message security (Security.Mode=EndToEndSecurityMode.Message) to ensure that payload data is protected end-to-end without ever becoming visible to a third party (including the Service Bus infrastructure) at any waypoint.

Uri Scheme (8)

  • sb implies WCF on the client.
  • http/https support non-WCF clients.

Choice of connectivity modes (9)

  1. TcpConnectionMode.Relayed: In this mode, all communication is relayed through the Service Bus cloud. The SSL-protected control connection is used to negotiate a relayed end-to-end socket connection that all Client-Service communication flows through. After the connection is established, the Service Bus infrastructure acts much like a socket forwarder proxy relaying a bidirectional byte stream.
  2. TcpConnectionMode.Hybrid: In this mode, communication is relayed through the Service Bus infrastructure while the Client and Service endpoints negotiate a direct socket connection to each other. The coordination of this direct connection is governed by the Service Bus cloud service. The direct socket connection algorithm is capable of establishing direct connections between two parties that sit behind opposing Firewalls and NAT devices. The algorithm uses only outbound connections for Firewall traversal and relies on a mutual port prediction algorithm for NAT traversal. Since the NAT traversal algorithm is dependent on a very narrowly timed coordination and a best-guess prediction about the expected NAT behavior, the algorithm tends to have a very high success rate for Home and Small Business scenarios with a small number of clients and degrades in its success rate with larger NATs. If a direct connection can be established, the relayed connection is automatically upgraded to the direct connection without message or data loss. If the direct connection cannot be established, data will continue to flow through the Service Bus Relay.
  3. TcpConnectionMode.Direct: This mode is identical to TcpConnectionMode.Hybrid in the .NET Services December 2008 CTP. In a future release, this mode will use the direct connection only once and, if established, never relay any application data through the Service Bus Relay.
Read More >>

Friday, February 6, 2009

What are the options — Azure and Access Control?

I wanted to find out what the options were for building access control into an application hosted in the cloud, so that I could limit what was made available to different users of my Azure hosted application. More precisely I wanted to be able to use someone’s LiveID as the authentication mechanism, and use that to control which areas of the site that person could see or access.

Option 1 — Blob Storage in Azure

So what options are there in in Azure itself? Looking through the Azure SDK documentation there is a discussion of access control for Azure Storage Services, so I thought this might provide the basis of an access control mechanism. On closer inspection I realized that this wasn’t going to help. First of all access control is only available for Blob Storage, and not for Queue or Table Storage. Secondly, a blob can only be made public or private, with no finer control over who can see the blob’s contents.

If you do want to use the Azure Storage Services you do (with the exception of public blobs) need to authenticate your request using your Azure account credentials. Given that Azure Storage is accessed using a REST API this means providing your encrypted credentials as part of the HTTP request. There is some help provided with this in the Azure SDK samples: take a look at the StorageClient Sample. The sample includes a client library that wraps the REST API, and also shows how you can access the .NET Client Library for ADO.NET Data Services to access Azure Table Storage.

This example shows the type of code you would write to use a private blob, notice that the access control is set on the container, rather than the blob itself, and the useful utility method that pulls the credential information from your config file.

BlobStorage bs = BlobStorage.Create(StorageAccountInfo.GetDefaultBlobStorageAccountFromConfiguration());

BlobContainer bc = bs.GetBlobContainer("list");

bc.CreateContainer(null, ContainerAccessControl.Private);

This code shows how you can then write to the blob using the sample client library, which is hiding all of the REST API from you:

BlobProperties props = new BlobProperties(txtItem.Text);

props.ContentType = "text/plain; charset=UTF-8";

BlobContents content = new BlobContents(Encoding.UTF8.GetBytes("This is the data to be stored in the blob!"));

bc.CreateBlob(props, content, true);

Option 2 — Membership Provider in Azure

The second option I looked at in Azure was to use ASP.NET membership. The default membership providers in ASP.NET use either SQL Server or Active Directory as their data sources, so neither are likely to work for a cloud hosted application. Digging around in the Azure SDK samples revealed this project here: AspProviders Sample. This project includes ASP.NET providers for Membership, Role, Profile and Session State. (Note: there is no ‘out of the box’ Session object in an Azure application because of the deployment model, this provider stores session state in Azure Storage.) The Membership and Role providers do exactly what you’d expect, and work with the standard ASP.NET Login controls. The providers use Azure table and blob storage to persist their data. This makes it very straightforward to set up authentication and authorization for your cloud application. What you would have to spend some effort on would be creating some administration tools to manage users and access control rules for the site.

Option 3 — Using Live ID with the Azure Membership Provider

My goal though was to use Live ID as my authentication mechanism, so is there a way of integrating Live ID with the Azure membership provider? My starting point here was to download the Windows Live Tools for Microsoft Visual Studio. The tools include a number of controls, in particular IDLoginStatus and IDLoginView, and a couple of new Visual Studio project templates: Windows Live Web Application and Windows Live Web Role (template for Windows Azure Cloud Projects) that looked useful. These two controls simplify using a Live ID to authenticate with your site, handling the redirects to the standard Live login page and back to your site. Although the controls a simple to use, there is a bit of setup to manage first. To start with you need to identify your site to Live and this requires a unique Application ID, a Secret Key and a return URL so that Live can redirect the browser back to your site after a successful log in. This can all be done at Live Services, where you can create a new project to define this information. You can then add an IDLoginStatus control to your page, and then chose the ‘Configure Application ID’ task to automatically add the Application ID and Secret Key to your web.config file.

The IDLoginStatus control has a ‘LoggedInLiveID’ property that tells you whether the user has logged in or not. What you can’t do is find out anything more about the user, other than their unique ApplicationUserID.

Is there a way to associate the ApplicationUserID with a user in the membership system, and so implement some access control on your site? This is where the second control, IDLoginView, comes in. This is a templated control with these templates:

  • AnonymousTemplate: the user is not logged in at all.
  • LoggedInTemplate: the user is only logged in using the ASP.NET membership system.
  • LoggedInIDTemplate: the user is only logged in with a Live ID.
  • LoggedInAllTemplate: the user is logged in with both the ASP.NET membership system and with a Live ID.
  • AssociatePromptTemplate: the user is prompted to associate their Live ID with their membership id.

The control can also be configured to automatically associate their Live ID with their membership id, and once the association has been made then then logging in with Live automatically logs the user into the membership system. So from then on I have a site that uses a Live ID for authentication, and ASP.NET membership to control access.

I got all of this working in a standard ASP.NET application, and then tried it in a cloud application and this is where I got stuck. The IDLoginView control sets up the association between the membership ID and the Live ID by adding a new table ‘aspnet_LiveIDAssociation’ to the ASPNETDB database, and assumes that the membership provider is the standard SQL membership provider. Running in the cloud, I’m not using the standard membership provider, so any attempt to add an association fails. To get this scenario to work I’d probably have to modify the sample Azure membership provider and handle a lot of the Live ID login process manually…

Option 4 — Using Live ID and the Access Control Service

Access Control Service is one of the cloud infrastructure services (along with the Service Bus and Workflow Service) that are part of the Azure platform. The Access Control Service is ‘a hosted, secure, standards-based infrastructure for multiparty, federated authentication and rules-driven, claims-based authorization’. I wanted to see if I could use it as an access control mechanism for a web site where I was authenticating users with Live Id.

To adopt some of the correct terminology, the Access Control Service is a Security Token Service (STS) and my web application is a relying party (RP). To briefly summarize how this process will work:

  1. My site prompts the user to login to the Access Control Service with their Live ID.
  2. The Live ID is mapped by the Access Control Service to set of claims (permissions) defined by me.
  3. The request is redirected back to the original page on my site. Elsewhere on my site the claims can be examined, and the appropriate logic applied to determine what the user can see or do.

There are a couple of important points to note at this point:

  • This process is complicated. Trust relationships must exist between the various parties; the Access Control Service is pre-configured to trust the Live Id system, but I have to define the trust relationship between my application and the Access Control Service. Information transferred between the sites must be secure.
  • The system is standards based, meaning that other authentication and authorization systems could be plugged in.
  • My application has completely outsourced the authentication and authorization rules. All my application needs to do is examine an incoming claim, such as ‘this person is an administrator’, and decide on the basis of that claim whether the user can see that page or perform that action.

There is no configuration needed for the Live ID login because there is already a trust relationship setup for Access Control Service, but I did have to code the login rather than use the IDLoginStaus control:

string homeRealm = "http://login.live.com";

string scope = "http://localhost/LiveACS/";

string acs = "https://accesscontrol.windows.net/passivests/YOURSOLUTIONNAME/LiveFederation.aspx";

 

var request = new SignInRequestMessage(new Uri(acs), scope);

request.Parameters.Add("whr", homeRealm);

 

Response.Redirect(request.RequestUrl);

The homeRealm is reason we can’t use the IDLoginStatus control, because the current version of the control doesn’t support the whr parameter.

The scope is used to match to a set of rules in your Access Control Service solution, and the solution name must be part of your Access Control Service address.

You can manage your Access Control Service solution here. You define a scope to hold a collection of rules, and a rule is made up of input claims (in this case a Live ID) and an output claim (in this case an Action), you also need to upload the public key of the certificate you will be using to encrypt the claim information that will be transferred to your application. (Note: if someone logs in but no input claims are matched here, then all they’ll see will be a standard 403 message).

Input Claim
Type: Windows Live ID Value: someone@liveid.com Issuer: live.com

 

Output Claim
Type: Action Value: LiveACS.ViewData Issuer: accesscontrol.windows.net/YOURSOLUTIONNAME

At this point I need to introduce another component. So far I’ve set up my site to enable logins using Live ID, the login can be used by the Access Control Service to identify a  set of claims to be encrypted and transferred to my application. How can a decrypt and understand the claims in my application? I could use WCF and the System.IdentityModel.Claims namespace, but the recommended approach seems to be to use the new Geneva Framework and the Microsoft.IdentityModel.Claims namespace for this job instead.

Once the Geneva Framework SDK is downloaded I ran the FedUtil.exe utility to update my web.config file:

<microsoft.identityModel>

  <audienceUris>

    <add value="http://localhost/LiveACS/" />

  </audienceUris>

  <issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry">

    <trustedIssuers>

      <add thumbprint="416e6fa5d982b096931fbf42c4a3dcd608856c95"

           name="http://accesscontrol.windows.net/YOURSOLUTIONNAME/"/>

    </trustedIssuers>

  </issuerNameRegistry>

  <federatedAuthentication enabled="true">

    <wsFederation passiveRedirectEnabled="true" issuer="https://login.live-int.com/login.srf" realm="http://localhost/LiveACS/" />

  </federatedAuthentication>

  <applicationService>

    <claimTypeRequired />

  </applicationService>

  <serviceCertificate>

    <certificateReference x509FindType="FindBySubjectDistinguishedName" findValue="CN=localhost" storeLocation="LocalMachine" storeName="My" />

  </serviceCertificate>

</microsoft.identityModel>

It added a bit more than what I’ve shown above – setting up various imports and modules – but these are the important elements. audienceUris determines where the tokens containing the claims will be sent. trustedIssuers specifies whose tokens we should trust. serviceCertificates identifies where to find the private key to decrypt the token that came from Access Control Service (this is the private key corresponding to the public key I uploaded to the scope).

Once all that is in place I can examine the claims in code and control access to parts of my site like this:

if (ClaimsVerification.ViewDataPermission) Label1.Visible = true;

Which uses a simple utility class:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using Microsoft.IdentityModel.Claims;

using System.Threading;

 

public class ClaimsVerification

{

    public static Boolean ViewDataPermission

    {

        get

        {

            IClaimsIdentity identity =

                Thread.CurrentPrincipal.Identity as IClaimsIdentity;

            if (identity == null) return false;

 

            return identity.Claims

                .Where(claim => claim.ClaimType.Equals("http://docs.oasis-open.org/wsfed/authorization/200706/claims/action") &&

                       claim.Value.Equals("LiveACS.ViewData"))

                .Count() > 0;

        }

    }

}

The ClaimType here is the full name of the ‘action’ type output claim I defined in the Access Control Service scope.

Can I use all this in a cloud application as I wanted? Unfortunately not yet – the reason being that the Geneva Framework classes are not available as part of the cloud services at the moment, so I guess I’ll just have to be patient!

Read More >>