Claims-based identities in ASP.NET MVC 4.5 using the standard ASP.NET providers

Lately I have done a bit of work with claims-based identities. Most of it has been about doing federated security using the Windows Azure Access Control Service. However, I have also been working with a client that wanted claims-based identity management without federating it. For the moment, they just want to run locally, but they want to be prepared for a future where they might expand and move to a federated paradigm. And also, the way that they handle multitenancy is a perfect fit for claims…

Interestingly enough, working through their scenario, I found that there is a lot of information on the web about how to set up claims-based identity management using federation, but there is not a whole lot around for running it locally… It might not be that surprising considering that federated security has some really good points. Having been faced with this lack of information, I had to come up with a solution on my own, and building on what I built for them, I decided to create an extended example…

More...

Compressing messages for the Windows Azure Service Bus

As a follow up to my previous post about encrypting messages for the Service Bus, I thought I would re-use the concepts but instead of encrypting the messages I would compress them.

As the Service bus has limitations on how big messages are allowed to be, compressing the message body is actually something that can be really helpful. Not that I think sending massive messages is the best thing in all cases, the 256kb limit can be a little low some times.

Anyhow… The basic idea is exactly the same as last time, no news there…but to be honest, I think this type of compressions should be there by default, or at least be available as a feature of BrokeredMessage by default… However, as it isn’t I will just make do with extension methods…

More...

Encrypting messages for the Windows Azure Service Bus

A week ago I ran into Alan Smith at the Stockholm Cental Station on the way to the Scandinavian Developer Conference. We were both doing talks about Windows Azure, and we started talking about different Windows Azure features and thoughts. At some point, Alan mentioned that he had heard a few people say that they would like to have their BrokeredMessages encrypted. For some reason this stuck with me, and I decided to give it a try…

My first thought was to enherit the BrokeredMessage class, and introduce encryption like that. Basically pass in an encryption startegy in the constructor, and handle all encryption and decryption inside this subclass. However, about 2 seconds in to my attempt, I realized that the BrokeredMessage class was sealed. An annoying, but somewhat understandable  decision made by Microsoft. Ok, so I couldn’t inherit the class, what can you do then? Well, there is no way to stop me from creating a couple of extension methods…

More...

A way to upload files to Windows Azure Mobile Services

Ok, so it is time for another Mobile Services post I believe. My previous posts about the subject has covered the basics as well as authentication when it comes to Mobile Service. But so far, I have only been doing the most simple tasks, such as added and read data from a SQL Database. However, I have mentioned that Mobile Services is supposed to be sort of a layer on top of more of Microsoft’s cloud offering like for example the Service Bus, storage etc. So in this post, I want to demo how you can utilize Mobile Services to upload files to blob storage.

There are probably a lot of different ways to do this, but 2 stood out for me. The one I am about to describe, using public containers, as well as using shared access signatures (SAS). So before going about it “my way”, I am going to explain SAS, and why I don’t like it even though it might be a “cleaner” way to do it.

More...

An Introduction to Windows Azure Mobile Services

At the time of writing, Mobile Services is still in preview, so I believe that you have to “request” access to it. But as soon as you have, you get a new icon in your menu in the Azure management portal, which is all cool. But what is Windows Azure Mobile Services (Mobile Services from now on)?

Well, Mobile Services is basically a “layer” on top of Microsofts cloud offering. Initially, it is a great abstraction for SQL Databases, but the idea, as I have understood it at least, is that it will grow as the amount of Azure services expand, giving the users a simple API to work against. And in doing so, will make us as developers much more productive. But as I said, today, it is basically a very nifty layer on top of SQL Databases. However, that layer is really cool, simple to work with, and supports very rapid development.

More...

Code from my testing presentation

Last week, I had the honor of having been invited to present my thoughts on testing at a IT consultant agency here in Stockholm. And even if I looked forward to it, and felt privileged to be allowed to share my view with these other devs, I still felt a bit hesitant. I was still going to step in front of a bunch of devs and present a somewhat less glorifying view on testing than you normally get. Not that I am all against testing, definitely not, but I do have a somewhat looser view on what, when and how to test software than say for example you regular TDD guy…

Walking in to the presentation, I had material for about an hour of presenting, and hoped to maybe extend it to an hour and a half with discussions and debate (I did hope for a lot of discussion as it was really the goal of my presentation). However, it turned out that after an hour and a half, we had a break for food, and then I kept going a bit more. I think we ended the session after almost 3 hours, even though I think it could probably been longer if I had pushed my points a bit more to the extreme than I did.

More...

Securing a NancyFx module with the Azure Access Control Service

In my previous post I gave a semi-quick introduction to NancyFx. This time, I want to take Nancy and combine it with Azure ACS. Not a very complicated thing as such, but still something I want to do as I enjoy working with both technologies.

Just as in the last post, I will self-host Nancy in a console application, and use NuGet to get it going. I will also re-use the “www.nancytesting.org” domain I set up in my hosts file in the last post.

Once I got my console application going with a host, and an empty NancyModule, it is time to start looking at the ACS.

More...

Trying Out NancyFx

As part of not doing very much coding lately, I have decided that I am going to try to spend more time trying out new frameworks and technologies. And hopefully, that will en up with a lot more blog posts with interesting stuff. This time I have looked at a ridiculously funky micro framework for building HTTP-based services called NancyFx. It is really simple to get started with, but still very powerful…and modern…

Nancy can be hosted in a variety of ways, including in ASP.NET MVC, WCF and self-hosting. In this post, I will look at hosting Nancy in a console application as I had little interest in setting up anything big. And using NuGet, it was a piece of cake to get started. Just start up a new Console application project and then NuGet Nancy.Hosting.Self.

More...

Sample code from my LEAP presentation about cross-framework code sharing

Yesterday I was invited to speak in front of a bunch of really sharp guys attending the Lead Enterprise Architecture Program, LEAP, at Microsoft here in Stockholm. The topic of the day was how to share code between projects targeting multiple frameworks/platforms. Basically “how can we share code between projects aimed at WP7, Windows 8, Silverlight and WPF” in a useful way, limiting the duplication of code as well as maintenance.

Most of my presentation revolved around a sample I had written to target all platforms. It is a very simple application, but still shows that it is very possible to get it to work.

More...

Software Passion Summit – Service Bus talk, code and ppt

Today I presented an introduction to the Azure Service bus here at Software Passion Summit. As a part of that presentation, I promised to upload the code and PPT to the blog, which is what I am doing here. I am pretty sure that the PPT is pretty useless as it contains very little useful information, but I thought I would put it here anyway.

One little note though. To be able to test the code, you have to get your own Service bus namespace as I have removed my details from the code. Reason? Well, I only have limited free usage of the bus, and I really don’t feel like getting a big bill because someone wrote some code that hammered my namespace with requests… I hope that is understandable…

More...