public static void AddIdentityApiService(this IServiceCollection services, IConfiguration configuration) { IdentityInjectionHelper.Init(ref services); services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.TryAddScoped <IUsersContext, UsersContext>(); services.AddJwtToken(configuration); }
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")); }
public IdentitySSOAuthorizeAttribute() { _loginActionName = DEFAULT_ACTION_NAME; _authenticationScheme = DEFAULT_AUTH_SCHEME; _loginControllerName = DEFAULT_CONTROLLER_NAME; _signInService = IdentityInjectionHelper.GetService <ISignInRequestService>(); _authenticateRequestService = IdentityInjectionHelper.GetService <IAuthenticateRequestService>(); }
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>(); }
public IdentitySSOAuthorizeAttribute(string controllerName, string actionName, string authenticationScheme, IAuthenticateRequestService authenticateRequestService = null, ISignInRequestService signInService = null) { _loginActionName = actionName; _loginControllerName = controllerName; _authenticationScheme = string.IsNullOrEmpty(authenticationScheme) ? DEFAULT_AUTH_SCHEME : authenticationScheme; _signInService = signInService != null ? signInService :IdentityInjectionHelper.GetService <ISignInRequestService>(); _authenticateRequestService = authenticateRequestService != null ? authenticateRequestService : IdentityInjectionHelper.GetService <IAuthenticateRequestService>(); }
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; }); }
public static void AddIdentityWebService(this IServiceCollection services, string identityServerUrl = null) { ConfigureServices(services); IdentityInjectionHelper.SetBaseUrl(identityServerUrl); }