/// <summary>
    /// Replaces the existing <see cref="AccountClaimsPrincipalFactory{TAccount}"/> with the user factory defined by <typeparamref name="TAccountClaimsPrincipalFactory"/>.
    /// </summary>
    /// <typeparam name="TRemoteAuthenticationState">The remote authentication state.</typeparam>
    /// <typeparam name="TAccount">The account type.</typeparam>
    /// <typeparam name="TAccountClaimsPrincipalFactory">The new user factory type.</typeparam>
    /// <param name="builder">The <see cref="IRemoteAuthenticationBuilder{TRemoteAuthenticationState, TAccount}"/>.</param>
    /// <returns>The <see cref="IRemoteAuthenticationBuilder{TRemoteAuthenticationState, TAccount}"/>.</returns>
    public static IRemoteAuthenticationBuilder <TRemoteAuthenticationState, TAccount> AddAccountClaimsPrincipalFactory <TRemoteAuthenticationState, TAccount, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TAccountClaimsPrincipalFactory>(
        this IRemoteAuthenticationBuilder <TRemoteAuthenticationState, TAccount> builder)
        where TRemoteAuthenticationState : RemoteAuthenticationState, new()
        where TAccount : RemoteUserAccount
        where TAccountClaimsPrincipalFactory : AccountClaimsPrincipalFactory <TAccount>
    {
        builder.Services.Replace(ServiceDescriptor.Scoped <AccountClaimsPrincipalFactory <TAccount>, TAccountClaimsPrincipalFactory>());

        return(builder);
    }
Exemplo n.º 2
0
        /// <summary>
        /// Replaces the existing <see cref="AccountClaimsPrincipalFactory{TAccount}"/> with the user factory defined by <typeparamref name="TAccountClaimsPrincipalFactory"/>.
        /// </summary>
        /// <typeparam name="TRemoteAuthenticationState">The remote authentication state.</typeparam>
        /// <typeparam name="TAccount">The account type.</typeparam>
        /// <typeparam name="TAccountClaimsPrincipalFactory">The new user factory type.</typeparam>
        /// <param name="builder">The <see cref="IRemoteAuthenticationBuilder{TRemoteAuthenticationState, TAccount}"/>.</param>
        /// <returns>The <see cref="IRemoteAuthenticationBuilder{TRemoteAuthenticationState, TAccount}"/>.</returns>
        public static IRemoteAuthenticationBuilder <TRemoteAuthenticationState, TAccount> AddAccountClaimsPrincipalFactory <TRemoteAuthenticationState, TAccount, TAccountClaimsPrincipalFactory>(
            this IRemoteAuthenticationBuilder <TRemoteAuthenticationState, TAccount> builder)
            where TRemoteAuthenticationState : RemoteAuthenticationState, new()
            where TAccount : RemoteUserAccount
            where TAccountClaimsPrincipalFactory : AccountClaimsPrincipalFactory <TAccount>
        {
            builder.Services.Replace(ServiceDescriptor.Scoped <AccountClaimsPrincipalFactory <TAccount>, TAccountClaimsPrincipalFactory>());

            return(builder);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Replaces the existing <see cref="AccountClaimsPrincipalFactory{TAccount}"/> with the user factory defined by <typeparamref name="TAccountClaimsPrincipalFactory"/>.
        /// </summary>
        /// <typeparam name="TRemoteAuthenticationState">The remote authentication state.</typeparam>
        /// <typeparam name="TAccount">The account type.</typeparam>
        /// <typeparam name="TAccountClaimsPrincipalFactory">The new user factory type.</typeparam>
        /// <param name="builder">The <see cref="IRemoteAuthenticationBuilder{TRemoteAuthenticationState, TAccount}"/>.</param>
        /// <returns>The <see cref="IRemoteAuthenticationBuilder{TRemoteAuthenticationState, TAccount}"/>.</returns>
        public static IRemoteAuthenticationBuilder <TRemoteAuthenticationState, TAccount> AddAccountClaimsPrincipalFactory <TRemoteAuthenticationState, TAccount, TAccountClaimsPrincipalFactory>(
            this IRemoteAuthenticationBuilder <TRemoteAuthenticationState, TAccount> builder)
            where TRemoteAuthenticationState : OidcAuthenticationState, new()
            where TAccount : RemoteUserAccount
            where TAccountClaimsPrincipalFactory : AccountClaimsPrincipalFactory <TAccount>
        {
            if (builder is null)
            {
                throw new System.ArgumentNullException(nameof(builder));
            }

            builder.Services.Replace(ServiceDescriptor.Scoped <AccountClaimsPrincipalFactory <TAccount>, TAccountClaimsPrincipalFactory>());

            return(builder);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Replaces the existing <see cref="AccountClaimsPrincipalFactory{TAccount}"/> with the user factory defined by <typeparamref name="TAccountClaimsPrincipalFactory"/>.
 /// </summary>
 /// <typeparam name="TAccountClaimsPrincipalFactory">The new user factory type.</typeparam>
 /// <param name="builder">The <see cref="IRemoteAuthenticationBuilder{RemoteAuthenticationState, Account}"/>.</param>
 /// <returns>The <see cref="IRemoteAuthenticationBuilder{RemoteAuthenticationState, Account}"/>.</returns>
 public static IRemoteAuthenticationBuilder <OidcAuthenticationState, RemoteUserAccount> AddAccountClaimsPrincipalFactory <TAccountClaimsPrincipalFactory>(
     this IRemoteAuthenticationBuilder <OidcAuthenticationState, RemoteUserAccount> builder)
     where TAccountClaimsPrincipalFactory : AccountClaimsPrincipalFactory <RemoteUserAccount> => builder.AddAccountClaimsPrincipalFactory <OidcAuthenticationState, RemoteUserAccount, TAccountClaimsPrincipalFactory>();
 /// <summary>
 /// Replaces the existing <see cref="AccountClaimsPrincipalFactory{TAccount}"/> with the user factory defined by <typeparamref name="TAccountClaimsPrincipalFactory"/>.
 /// </summary>
 /// <typeparam name="TAccountClaimsPrincipalFactory">The new user factory type.</typeparam>
 /// <param name="builder">The <see cref="IRemoteAuthenticationBuilder{RemoteAuthenticationState, Account}"/>.</param>
 /// <returns>The <see cref="IRemoteAuthenticationBuilder{RemoteAuthenticationState, Account}"/>.</returns>
 public static IRemoteAuthenticationBuilder <RemoteAuthenticationState, RemoteUserAccount> AddAccountClaimsPrincipalFactory <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TAccountClaimsPrincipalFactory>(
     this IRemoteAuthenticationBuilder <RemoteAuthenticationState, RemoteUserAccount> builder)
     where TAccountClaimsPrincipalFactory : AccountClaimsPrincipalFactory <RemoteUserAccount> => builder.AddAccountClaimsPrincipalFactory <RemoteAuthenticationState, RemoteUserAccount, TAccountClaimsPrincipalFactory>();