public ClaimsTransformationMiddleware(
     [NotNull] RequestDelegate next,
     [NotNull] ClaimsTransformationOptions options)
 {
     Options = options;
     _next   = next;
 }
 /// <summary>
 /// Adds the <see cref="ClaimsTransformationMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables claims transformation capabilities.
 /// </summary>
 /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
 /// <param name="configureOptions">An action delegate to configure the provided <see cref="ClaimsTransformationOptions"/>.</param>
 /// <returns>A reference to this instance after the operation has completed.</returns>
 public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, Action<ClaimsTransformationOptions> configureOptions)
 {
     var options = new ClaimsTransformationOptions();
     if (configureOptions != null)
     {
         configureOptions(options);
     }
     return app.UseClaimsTransformation(options);
 }
 /// <summary>
 /// Adds the <see cref="ClaimsTransformationMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables claims transformation capabilities.
 /// </summary>
 /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
 /// <param name="transform">A function that asynchronously transforms one <see cref="ClaimsPrincipal"/> to another.</param>
 /// <returns>A reference to this instance after the operation has completed.</returns>
 public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, Func<ClaimsPrincipal, Task<ClaimsPrincipal>> transform)
 {
     var options = new ClaimsTransformationOptions();
     options.Transformer = new ClaimsTransformer
     {
         OnTransform = transform
     };
     return app.UseClaimsTransformation(options);
 }
        public ClaimsTransformationMiddleware(
            RequestDelegate next,
            ClaimsTransformationOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            Options = options;
            _next = next;
        }
Example #5
0
        public ClaimsTransformationMiddleware(
            RequestDelegate next,
            ClaimsTransformationOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            Options = options;
            _next   = next;
        }
 /// <summary>
 /// Adds the <see cref="ClaimsTransformationMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables claims transformation capabilities.
 /// </summary>
 /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
 /// <param name="options">A <see cref="ClaimsTransformationOptions"/> that specifies options for the middleware.</param>
 /// <returns>A reference to this instance after the operation has completed.</returns>
 public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, ClaimsTransformationOptions options)
 {
     return app.UseMiddleware<ClaimsTransformationMiddleware>(options);
 }