Question

So i installed the glimpse (http://getglimpse.com/) nuget package in my mvc3 app. Wow neat tool. But has anyone figured out how to inspect adfs claims in glimplse? I can see the "AUTH_USER" on the server tab, but doesn't have any of the claims or roles that i get shipped from adfs. If its not supported out of the box maybe ill write a plugin.

Solution: I wrote a plugin that seems to work great. Thanks for the help and the great product Nik!

using System.Collections.Generic;
using System.Linq;
using Glimpse.AspNet.Extensions;
using Glimpse.Core.Extensibility;
using Microsoft.IdentityModel.Claims;

namespace ADFSClaimsPlugin
{
    public class ADFSClaimsInspector : TabBase
    {
        public override object GetData(ITabContext context)
        {
            var res = new List<string[]> { new[] { "Subject", "Type", "Value", "Value Type", "Issuer", "Original Issuer" } };
            var httpContext = context.GetHttpContext();

            var iPrincipal = (IClaimsPrincipal)httpContext.User;
            var identity = (IClaimsIdentity)iPrincipal.Identity;

            res.AddRange(identity.Claims.Select(c => new[] {  c.Subject==null?string.Empty:c.Subject.ToString(),c.ClaimType, 
                c.Value, c.ValueType, c.Issuer ,c.OriginalIssuer }));

            return res;
        }

        public override string Name
        {
            get { return "Claim Data"; }
        }
    }
}
Was it helpful?

Solution

I'm not an expert in this stuff, but Maarten Balliauw created a Window Identity Foundation plugin awhile back which showed off claims tokens - it may be a good starting point for you.

His plugin is a bit out of date (it will no longer work with Glimpse 1.0+), but it should be easy to update and package based on the custom tab documentation.

I'm also more than happy to help you out. You can contact me on Twitter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top