Sakura.AspNetCore.Extensions/Sakura.AspNetCore.Authentication.ExternalCookie/IdentityHelper.cs
/// <summary>
///     Create a new <see cref="ClaimsPrincipal" /> based on a existing <see cref="ClaimsPrincipal" /> with a new
///     authentication type for all of its identities.
/// </summary>
/// <param name="principal">The principal to be cloned.</param>
/// <param name="authenticationType">The authentication type of the new identity.</param>
/// <returns>The cloned new principal.</returns>
/// <exception cref="ArgumentNullException">
///     The <paramref name="principal" /> or <paramref name="authenticationType" /> is
///     <c>null</c>.
/// </exception>
Create a new  based on a existing  with a new
authentication type for all of its identities.
Create a new based on a existing with a new authentication type for all of its identities .
public static ClaimsPrincipal CloneAs(this ClaimsPrincipal principal, string authenticationType)
		{
			if (principal == null)
				throw new ArgumentNullException(nameof(principal));
			if (authenticationType == null)
				throw new ArgumentNullException(nameof(authenticationType));
			var newIdentities = principal.Identities.Select(i => i.CloneAs(authenticationType));
			return new ClaimsPrincipal(newIdentities);
		}
public static ClaimsPrincipal CloneAs ( this ClaimsPrincipal principal , string authenticationType ) { if ( principal == null ) throw new ArgumentNullException ( nameof ( principal ) ) ; if ( authenticationType == null ) throw new ArgumentNullException ( nameof ( authenticationType ) ) ; var newIdentities = principal . Identities . Select ( i => i . CloneAs ( authenticationType ) ) ; return new ClaimsPrincipal ( newIdentities ) ; }
Create a new  based on a existing  with a new
authentication type for all of its identities.
Create a new based on a existing with a new authentication type for all of its identities .
The cloned new principal.
The cloned new principal .
The  or  is
null
The or is null
ClaimsPrincipal
this
authenticationType
string
The authentication type of the new identity.
The authentication type of the new identity .
principal
The principal to be cloned.
The principal to be cloned .