示例#1
0
 public static IAppBuilder RegisterVueStorefrontAuth(this IAppBuilder bulder, VsfApiBridgeConfiguration configuration)
 {
     bulder.UseJwtBearerAuthentication(new JwtBearerAuthenticationOptions
     {
         AuthenticationType        = "VueStorefronToken",
         TokenValidationParameters = new TokenValidationParameters
         {
             IssuerSigningKey = configuration.IssuerSigningKey.ToSymmetricSecurityKey(),
             ValidIssuer      = configuration.ValidIssuer,
             ValidAudience    = configuration.ValidAudience,
             ValidateLifetime = true,
         },
         Provider = new VsfJwtBearerTokenProvider()
     });
     return(bulder);
 }
示例#2
0
 public static void RegisterVueStorefrontBridgeDefaultService(this IServiceConfigurationProvider services, VsfApiBridgeConfiguration bridgeConfiguration)
 {
     services.AddSingleton(bridgeConfiguration);
     services.AddTransient <IUserEndpoint, UserEndpoint <VsfUser> >();
     services.AddTransient <ICartEndpoint, CartEndpoint>();
     services.AddTransient <IStockEndpoint, StockEndpoint>();
     services.AddTransient <IOrderEndpoint, OrderEndpoint>();
     services.AddScoped <QuicksilverDbContext>();
     services.AddScoped <IRefreshTokenRepository, DatabaseRefreshTokenRepository>();
     services.AddScoped <IUserTokenProvider, JwtUserTokenProvider>();
     services.AddTransient <IUserClaimsProvider <VsfUser>, UserClaimsProvider <VsfUser> >();
 }