// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Security.Claims;
using Microsoft.AspNetCore.Http.Authentication;
namespace Microsoft.AspNetCore.Authentication
{
///
/// Contains user identity information as well as additional authentication state.
///
public class AuthenticationTicket
{
///
/// Initializes a new instance of the class
///
/// the that represents the authenticated user.
/// additional properties that can be consumed by the user or runtime.
/// the authentication middleware that was responsible for this ticket.
public AuthenticationTicket(ClaimsPrincipal principal, AuthenticationProperties properties, string authenticationScheme)
{
if (principal == null)
{
throw new ArgumentNullException(nameof(principal));
}
AuthenticationScheme = authenticationScheme;
Principal = principal;
Properties = properties ?? new AuthenticationProperties();
}
///
/// Gets the authentication type.
///
public string AuthenticationScheme { get; private set; }
///
/// Gets the claims-principal with authenticated user identities.
///
public ClaimsPrincipal Principal{ get; private set; }
///
/// Additional state values for the authentication session.
///
public AuthenticationProperties Properties { get; private set; }
}
}