Manual JWT Validation against Azure Active Directory

For our current WebApi project we decided to implement OAuth2 authentication with Azure Active Directory. As our API needs to support other authentication mechanisms like Basic and Negotiate beside OAuth2 we implemented multiple authentication filters that, where each filter is responsible for a specific authentication mechanism. One of these authentication filters, the BearerAuthenticationFilter, is responsible […]

Get NetworkCredential from PSCredential splits Username into Username and Domain

During development of a PowerShell binary module I had to do deal with two different credential types (System.Management.Automation.PSCredential and System.Net.NetworkCredential) and came across a behaviour I wanted to write down. The PowerShell binary module I developed contains several Cmdlets. One of them defines a parameter of type System.Management.Automation.PSCredential. Inside the Cmdlet we need to have […]

[NoBrainer] Adding meaningful error messages when using Contract.Result in C#

CodeContract error message

We at d-fens use Microsoft Code Contracts every day. And certainly with every great tool there are some things that might benefit from some improvement – and code contracts are no exception. There is one particular annoying thing in that the error message for Contract.Result exceptions strips the generic parameters from it. This in essence […]