Configuring an ASP.NET site to use WS-Federation

After having blogged a couple of times about how to build a simple STS, how to use claims based authentication in MVC 4.5 and how to set up federation with Azure Access Control Service, I thought it might be time to post a quick walkthrough of how to set up a simple federation with an existing STS.

Why did I think of that right now? Well, the pretty awesome “Identity and Access Tool” extension to Visual Studio has been removed from later versions of Visual Studio, making setting up federation a manual task. Unless you do it as you set up your application... And having been playing around with federation for a couple of days now in a project that wasn’t set up from scratch, I decided to just add a quick blog post on how to do a simple set up with the least amount of effort.

More...

Combining ASP.NET MVC and Web API for content negotiation goodness

Ok, so this post sprung out of an idea that I have had in my head for a while. I know it will probably be solved better in ASP.NET v.Next, and can probably be solved in a bunch of other ways using only Web API or only MVC, but I wanted to see if I could use both to do it…

So what is IT? Well… In Web API, we have the ability to use content negotiation out of the box. Unfortunately, that content negotiation is, at least by default, based around serializing to XML or JSON. It doesn’t include all the view goodness that MVC has. There is no simple way to ask Web API to return a Razor view… So if I want to have content negotiation to handle both serialized data and views, we need to do some work…

On top of that, my solution would work nicely together with an existing MVC application, making it “easy” to add API features and content negotiation to the existing MVC URLs.

More...

Code from my MVVM presentation at DevSum14

During my MVVM presentation yesterday, I promised to upload the code to my blog. So here it is! Go ahead and run the application, put some breakpoints in there and see what is actually happening. It should give you a good baseline for a simple, and small “pay for play” MVVM framework. And if you have any questions, Just ask them in the comments, or via e-mail or Twitter…

Download: FiftyNine.MVVM.zip (517.57 kb)

Understanding OWIN – more on the IAppBuilder abstraction and middleware creation

In my last couple of posts, I have talked about OWIN. What it is, how it works, why it is interesting and so on. I have talked mostly about the hosting side of it, and a bit about how we can plug into the OWIN pipeline using what is called middleware… However, so far, the middleware has been ridiculously simple, and done very little, which isn’t really helpful I guess. And besides not doing very much interesting work, they have also not interacted very much with the request pipeline. Most of them, or maybe even all of them, have just terminated the pipeline and returned a simple response…

In this post, I want to take a look at how OWIN abstracts the server, and the request and response, and also how we can use this abstraction to extend the functionality of our pipeline.

More...

Another day, another TechEd

Once again, I was lucky enough to get a spot as a speaker at TechEd USA. This year, I am speaking about the SOLID principles, and about ASP.NET Web API. So far, I have managed to get one talk under my belt, and I personally think it went well!

An interesting, and kind of sucky part about TechEd this year is the fact that it has been sold out, and put in a location where there is not enough even enough room for everyone to attend the keynote sessions. Speakers were asked to not attend it, but instead watch it in one of the “overflow rooms”. Unfortunately, even these seemed to overflow. So I watched the keynote on a big screen TV in the exhibition area.

More...

Understanding OWIN – more on hosting

My last post about OWIN covered a little bit about the different hosting options, and then quite a bit about OWIN middleware. However, I found the hosting coverage to be a little weak, so I thought I would do one more, much shorter post, on just the different hosts available.

As mentioned before, there are 4 different OWIN hosts available from Microsoft. 3 from project Katana and one from project Helios.

Actually, there are 5. There is also a test host that can be used to test OWIN middleware in Unit tests etc in-memory, instead of having to open a port and listen for incoming requests…

The first, and simplest to get started with is the Katana self-host. But since we saw that being used in the last post, I will skip that one…

More...

Code from my TechEd talk about SOLID

Ok, so I thought I would upload the code from my TechEd presentation about the SOLID principles here. But before you go and download it, I want to mention that it is a contrived example, and that it might not be “proper” SOLID in all places. However, that is what you get when you have to present an application, and go through all the SOLID principles using it, in 1 hour and 15 minutes… Winking smile

Code available here: TechEd.Demo.SolidPrinciples.zip (538.16 kb)

Understanding OWIN – hosting and middleware

In my previous post about OWIN, I talked a bit about what OWIN is, and why it is important. This time, I want to take a little more of a dive into how we can use it, and how we code things using it.

var http = require('http');
var server = http.createServer(function(req,res) {
res.end('Hello World');
});
server.listen(8080);
console.log('Server running...listening on port 8080');

The above code snippet has nothing at all to do with OWIN. It is actually Node.js code for creating a web server and responding to HTTP requests. However, the above code is the main reason I like Node. The simplicity and tiny amount of code needed to get going is awesome!

It doesn’t do much, but it gives as a very crude, but powerful starting point in just a couple of lines of code. It is then up to us to take it from there and do what we want. Something we often do by turning to our package manager and asking for some cool functionality that someone else has already built.

More...

What is OWIN, and what is it doing in my new ASP.NET MVC project?

Ok, so straying a bit away from the AngularJS posts I have been doing lately, I want to talk a bit about OWIN. Why? Well, I recently took a look at it, after putting it off WAY too long, and found it to be awesome! And the goal with this post is to explain what it is, why it is cool, and why Microsoft is putting it into ASP.NET MVC projects by default…

But let’s start with “what is OWIN”… Well, OWIN stands for “Open Web Interface for .NET” and you can find more about OWIN as such at http://owin.org/. And now that you are back from that site, you are probably not a whole lot more in tune with what OWIN is, and the reason for that is probably that the site contains very little information. And it contains that little information because OWIN _is_ really that small. It is just a definition of an interface used to decouple the web applications we build, from the servers that are hosting it…

More...

A simple introduction to AngularJS, Part 6 – Dependency injection in Angular using $provide

In the last part, we went had a thorough look at scopes, and scope “inheritance”. That means that we have now covered setting up Angular, creating modules and controllers, and how to utilize two-way data binding using the scope object. The next step is to learn how to work with dependency injection in Angular to provide the same dependency injected service structure that Angular uses internally.

Dependency injection isn’t complicated as such, you register a service that another unit of code can request to get access to. That is the extremely simple definition. To support this in Angular we depend on the $provide service. This service is used to locate dependencies that other pieces of code require. Unfortunately, something as simple as this, actually becomes a little complicated and hard to grasp in Angular. Not because it is really complicated, but because there are so many options…

More...