コード例 #1
0
 public UserClaimsService(AlloyContext context, IMemoryCache cache, ClaimsTransformationOptions options, IS3PlayerApiClient s3PlayerApiClient)
 {
     _context           = context;
     _options           = options;
     _cache             = cache;
     _s3PlayerApiClient = s3PlayerApiClient;
 }
コード例 #2
0
 public static IAppBuilder UseClaimsTransformation(this IAppBuilder app, ClaimsTransformationOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException("options");
     }
     app.Use(typeof(ClaimsTransformationMiddleware), options);
     return(app);
 }
コード例 #3
0
        /// <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));
        }
コード例 #4
0
        /// <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));
        }
コード例 #5
0
 public UserClaimsService(PlayerContext context,
                          IMemoryCache cache,
                          ClaimsTransformationOptions options,
                          IMapper mapper)
 {
     _context = context;
     _options = options;
     _cache   = cache;
     _mapper  = mapper;
 }
コード例 #6
0
 /// <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));
 }
コード例 #7
0
 public UserClaimsService(SteamfitterContext context, IMemoryCache cache, ClaimsTransformationOptions options)
 {
     _context = context;
     _options = options;
     _cache   = cache;
 }
コード例 #8
0
 public ClaimsTransformationMiddleware(Func <IDictionary <string, object>, Task> next, ClaimsTransformationOptions options)
 {
     _next    = next;
     _options = options;
 }