using Microsoft.AspNet.Http.Authentication; using System; using System.Linq; using System.Security.Claims; namespace OAuth.AspNet.AuthServer { /// /// Exposes the security.SignIn environment value as a strong type. /// public class AuthenticationResponseGrant { /// /// Initializes a new instance of the class. /// /// /// public AuthenticationResponseGrant(ClaimsIdentity identity, AuthenticationProperties properties) { Principal = new ClaimsPrincipal(identity); Identity = identity; Properties = properties; } /// /// Initializes a new instance of the class. /// /// /// public AuthenticationResponseGrant(ClaimsPrincipal principal, AuthenticationProperties properties) { if (principal == null) { throw new ArgumentNullException("principal"); } Principal = principal; Identity = principal.Identities.FirstOrDefault(); Properties = properties; } /// /// The identity associated with the user sign in. /// public ClaimsIdentity Identity { get; private set; } /// /// The security principal associated with the user sign in. /// public ClaimsPrincipal Principal { get; private set; } /// /// Dictionary used to store state values about the authentication session. /// public AuthenticationProperties Properties { get; private set; } } }