public static void AddIdentityApiService(this IServiceCollection services, IConfiguration configuration)
 {
     IdentityInjectionHelper.Init(ref services);
     services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
     services.TryAddScoped <IUsersContext, UsersContext>();
     services.AddJwtToken(configuration);
 }
Esempio n. 2
0
 public static void AddOption(this IServiceCollection services, IConfiguration configuration)
 {
     DependencyInjectionHelper.Init(ref services);
     IdentityInjectionHelper.Init(ref services);
     services.AddOptions();
     services.Configure <ApiServer>(configuration.GetSection("ApiServer"));
 }
Esempio n. 3
0
 private static void ConfigureServices(IServiceCollection services)
 {
     IdentityInjectionHelper.Init(ref services);
     services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
     services.TryAddScoped <IUsersContext, UsersContext>();
     services.TryAddScoped <ISignInRequestService, SignInRequestService>();
     services.TryAddScoped <IRolesRequestServices, RolesRequestServices>();
     services.TryAddScoped <IAccountsRequestService, AccountsRequestService>();
     services.TryAddScoped <IAuthenticateRequestService, AuthenticateRequestService>();
 }
 public static void AddIdentityFrontEndService(this IServiceCollection services, IConfiguration configuration, string identityServerUrl = "")
 {
     IdentityInjectionHelper.Init(ref services);
     IdentityInjectionHelper.SetBaseUrl(identityServerUrl);
     services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
     services.TryAddScoped <IUsersContext, UsersContext>();
     services.TryAddScoped <ISignInRequestService, SignInRequestService>();
     services.TryAddScoped <IRolesRequestServices, RolesRequestServices>();
     services.TryAddScoped <IAccountsRequestService, AccountsRequestService>();
     services.TryAddScoped <IAuthenticateRequestService, AuthenticateRequestService>();
 }
Esempio n. 5
0
 public static void AddIdentityBackEndService(this IServiceCollection services, IConfiguration configuration)
 {
     IdentityInjectionHelper.Init(ref services);
     services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
     services.TryAddScoped <IUsersContext, UsersContext>();
     services.AddOptions();
     services.Configure <JwtTokenOption>(configuration.GetSection("JwtTokenOption"));
     services.AddAuthentication()
     .AddJwtBearer(options =>
     {
         options.TokenValidationParameters = JwtTokenBuilderHelper.DefaultBuilder.GetValidationParameters();
         options.SaveToken            = true;
         options.RequireHttpsMetadata = false;
     });
 }