Wednesday, October 26, 2016

ASP.NET MVC–WIF authentication pipeline is not invoked

After configuring my ASP.NET MVC application to use WSFederation with WIF, I was finally ready to run the app the first time. However instead of redirecting me to the configured STS and showing me a login page I ended up with a 401 Unauthorized error page.

I first thought that the required HTTP modules were missing, but no they were there:

Let’s have a look at the WIF configuration:

There is definetely something wrong here, but I had a hard time figuring out what. The problem is related to the passiveRedirectEnabled configuration setting. If you set passiveRedirectEnabled to false, WIF will no longer be responsible for the redirections to your issuers.

That explained a lot! Switching the setting to true solved my issue and I was finally welcomed by my STS login page…

Tuesday, October 25, 2016

WIF error: ID4175: The issuer of the security token was not recognized by the IssuerNameRegistry.

I’m currently working on a training for one of my customers covering WIF(Windows Identity Foundation),  OIDC(Open ID Connect) and some other security related topics on top of the .NET stack.

Yesterday I got a strange problem after configuring the MVC application that should act as the relying party.

Here is the WIF specific configuration:

And here is the error I got when I ran the application:

ID4175: The issuer of the security token was not recognized by the IssuerNameRegistry. To accept security tokens from this issuer, configure the IssuerNameRegistry to return a valid name for this issuer.

I compared the thumbprint of the certificate used by the STS with the thumbprint inside the config:

         <add thumbprint="6b 7a cc 52 03 05 bf db 4f 72 52 da eb 21 77 cc 09 1f aa e1" />


No matter how much I looked, I couldn’t see a difference.

Time to ask the global web for help. After some research I found the following article:

It seems there is a bug in the Richedit control that is used by the Certificate UI. When you copy the thumbprint, an extra (invisible) unicode character is being copied also. And indeed when I typed it in instead of copying it over, the error disappeared… Confused smile

Monday, October 24, 2016

VSTS: Monitor usage

Last week I discovered a new tab inside VSTS; the Usage tab.


The Usage tab shows the request history of the users ordered by usage( based on Team Services Throughput Units  or TSTUs). By default, visiting the Usage page will display requests for the last hour.


Another nice feature is that you can review the request history leading up to delayed requests.


Friday, October 21, 2016

Xamarin.Forms: INSTALL_FAILED_UPDATE_INCOMPATIBLE when trying to deploy to Android device

When we tried to deploy a Xamarin Forms app to an Android device, we got the following error:

InternalError ---> Mono.AndroidTools.InstallFailedException: Failure
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass2a.<InstallPackage>b__29(Task`1 t)
at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at Xamarin.AndroidTools.AndroidDeploySession.RunLogged(CancellationToken token)
at Xamarin.AndroidTools.AndroidDeploySession.Start(CancellationToken token)

The problem seemed to be that a "ghost" copy of the app still existed on the device although there was no app icon. However when searching under Applications we found it with its package name instead.

After uninstalling the package we were able to deploy the new version…

Thursday, October 20, 2016

The Open Guide to Amazon Webservices

I hear people talk about JavaScript fatigue, the constant churn of new frameworks, tools and libraries in the JavaScript ecosystem makes it difficult to keep up. I must say that I have the same feelings regarding Cloud, every week Microsoft, Google or Amazon announce a new PaaS, SaaS, FaaS,… offering.

A great resource to help you understand what’s going on inside the Amazon cloud space, is the Open Guide to Amazon Webservices.

From the github page:

A lot of information on AWS is already written. Most people learn AWS by reading a blog or a “getting started guide” and referring to the standard AWS references. Nonetheless, trustworthy and practical information and recommendations aren’t easy to come by. AWS’s own documentation is a great but sprawling resource few have time to read fully, and it doesn’t include anything but official facts, so omits experiences of engineers. The information in blogs or Stack Overflow is also not consistently up to date.

This guide is by and for engineers who use AWS. It aims to be a useful, living reference that consolidates links, tips, gotchas, and best practices. It arose from discussion and editing over beers by several engineers who have used AWS extensively.


Wednesday, October 19, 2016

NHibernate Issue: Unexpected updates are triggered

A colleague came to me with the following NHibernate problem; he loads some data from the database using the QueryOver syntax. Although he doesn’t do anything else with the data, NHibernate detects that the list is changed and tries to flush the changes to the database.

What’s causing NHibernate to think that an item has changed?

We figured out the reason after some investigation.

Inside our database we have nullable column e.g.:

Age [int] NULL  -- Nullable column

But inside the mapping we decided to map it to a not nullable property:

<property name="Age" />

public virtual int Age { get; set; }

The moment that the data is loaded and NHibernate sees a null value for Age, inside the property it will be set to 0(the default value for an int).

As the value has changed, NHibernate will detect this and tries to flush the change afterwards.

The solution is to make the property nullable:

public virtual int? Age { get; set; }

Tuesday, October 18, 2016

Testing your Akka.NET system using EventFilter

Although Akka.NET has built-in support for testing, it is sometimes hard to find out what’s really going on inside your actor system.

A useful feature that can help you solve this problem during integration testing is the EventFilter. The EventFilter is a tool to verify that actors write certain log messages. It can also detect if messages go to DeadLetters and if certain exceptions are thrown.

2 examples:

Remark: By default the event filter searches for exact matches.