OWIN pipeline account linking


		SecurityTokenValidated = (context) =>
                        {
                            ClaimsIdentity t = context.AuthenticationTicket.Identity;

                            t.AddClaims(new[] {
                                                            new Claim("authnContext", "UserAuthenticated"),
                                                            new Claim("RapAuthnContext", "UserAuthenticated")
                                                        });

                            if (t.Name.EndsWith("ae4iZRA_KmNnp3W_X8QVk2AUZB1EPARsrYQiX3SwSz4"))
                            {
                                var identity = new ClaimsIdentity(t.AuthenticationType, ClaimsIdentity.DefaultNameClaimType, ClaimsIdentity.DefaultRoleClaimType);
                                identity.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, "rapstaff"));
                                identity.AddClaims(t.Claims);
                                AuthenticationTicket ticket = new AuthenticationTicket(identity, context.AuthenticationTicket.Properties);
                                context.AuthenticationTicket = ticket;
                            }

                            return Task.FromResult(0);
                        }
Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in AAD. Bookmark the permalink.