// Copyright (c) Microsoft Open Technologies, Inc. // All Rights Reserved // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING // WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF // TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR // NON-INFRINGEMENT. // See the Apache 2 License for the specific language governing // permissions and limitations under the License. using System; using System.Security.Claims; using System.Security.Principal; namespace Microsoft.AspNet.Abstractions.Security { /// /// Acts as the return value from calls to the IAuthenticationManager's AuthenticeAsync methods. /// public class AuthenticationResult { /// /// Create an instance of the result object /// /// Assigned to Identity. May be null. /// Assigned to Properties. Contains extra information carried along with the identity. /// Assigned to Description. Contains information describing the authentication provider. public AuthenticationResult(IIdentity identity, AuthenticationProperties properties, AuthenticationDescription description) { if (properties == null) { throw new ArgumentNullException("properties"); } if (description == null) { throw new ArgumentNullException("description"); } if (identity != null) { Identity = identity as ClaimsIdentity ?? new ClaimsIdentity(identity); } Properties = properties; Description = description; } /// /// Contains the claims that were authenticated by the given AuthenticationType. If the authentication /// type was not successful the Identity property will be null. /// public ClaimsIdentity Identity { get; private set; } /// /// Contains extra values that were provided with the original SignIn call. /// public AuthenticationProperties Properties { get; private set; } /// /// Contains description properties for the middleware authentication type in general. Does not /// vary per request. /// public AuthenticationDescription Description { get; private set; } } }