/// <summary>
        /// Config JWT Token with options and DI Options[MRTokenOptions]
        /// </summary>
        /// <param name="services"></param>
        /// <param name="configuration"></param>
        /// <param name="tokenOptionsKey"></param>
        /// <param name="authenticationOptoins"></param>
        public static void ConfigureMRToken(this IServiceCollection services, IConfiguration configuration, string tokenOptionsKey,
                                            Action <AuthenticationOptions> authenticationOptoins = null)
        {
            authenticationOptoins = authenticationOptoins ?? new Action <AuthenticationOptions>((x) =>
            {
                x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                x.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            });

            var options = new MRTokenOptions();

            configuration.Bind(tokenOptionsKey, options);
            services.Configure <MRTokenOptions>(configuration.GetSection(tokenOptionsKey));
            services.AddTransient <MRTokenService>();
            services.AddAuthentication(authenticationOptoins)
            .AddJwtBearer(o =>
            {
                o.RequireHttpsMetadata      = options.RequireHttps;
                o.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
                {
                    ValidateIssuer           = options.ValidateIssuer,
                    ValidIssuer              = options.Issuer,
                    ValidateAudience         = options.ValidateAudience,
                    ValidAudience            = options.Audience,
                    ValidateLifetime         = options.ValidateLifetime,
                    IssuerSigningKey         = options.GetSecurityKey,
                    ValidateIssuerSigningKey = options.ValidateKey,
                    NameClaimType            = MRTokenDefaults.CLAIM_USER_ID,
                    RoleClaimType            = MRTokenDefaults.CLAIM_USER_ROLE
                };
            });
        }
 public ManagerUserControl(IHttpContextAccessor httpContextAccessor,
                           ILoggerFactory logger,
                           RepositoryRole repositoryRole,
                           RepositoryUser repositoryUser,
                           MRTokenService serviceToken,
                           IOptions <MRTokenOptions> tokenOptions,
                           ManagerUser managerUser,
                           IMapper mapper,
                           IRepositoryLanguage repositoryLanguage,
                           IRepositoryProvider repositoryProvider,
                           ConnectorBucketImageD bucketD,
                           ConnectorBucketImageR bucketR,
                           IRepositoryEmailChangeUnit repositoryEmailChangeUnit) : base(httpContextAccessor, logger, repositoryRole, repositoryUser, managerUser, mapper)
 {
     _repositoryProvider        = repositoryProvider;
     _serviceToken              = serviceToken;
     _tokenOptions              = tokenOptions.Value;
     _repositoryLanguage        = repositoryLanguage;
     _bucketD                   = bucketD;
     _bucketR                   = bucketR;
     _repositoryEmailChangeUnit = repositoryEmailChangeUnit;
 }