public static IServiceCollection AddJwtMessagePackRefreshTokenStore(this IServiceCollection services, Action <JwtStoreOptions> setup) { var jwtStoreOptions = new JwtStoreOptions(); setup(jwtStoreOptions); services.AddSingleton <IRefreshTokenStore> (sp => new MessagePackRefreshTokenStore(jwtStoreOptions)); return(services); }
/// <summary> /// Configures EF implementation of RefreshTokenStore with JwtSimpleServer. /// </summary> /// <param name="services">Service collection</param> /// <param name="jwtStoreOptions">The store options action.</param> /// <returns></returns> public static IServiceCollection AddJwtEntityFrameworkCoreRefreshTokenStore(this IServiceCollection services, Action <JwtStoreOptions> jwtStoreOptions) { var options = new JwtStoreOptions(); jwtStoreOptions(options); services.AddDbContext <JwtSimpleServerDbContext>(builder => { options.ConfigureDbContext?.Invoke(builder); }); services.AddScoped <IRefreshTokenStore, EntityFrameworkCoreRefreshTokenStore>(); return(services); }