OperationalStoreOptions.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
  2. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
  3. using System;
  4. using Microsoft.EntityFrameworkCore;
  5. namespace HaBook.IES.IdentityServer.AzureTableStorage.Options
  6. {
  7. /// <summary>
  8. /// Options for configuring the operational context.
  9. /// </summary>
  10. public class OperationalStoreOptions
  11. {
  12. /// <summary>
  13. /// Callback to configure the EF DbContext.
  14. /// </summary>
  15. /// <value>
  16. /// The configure database context.
  17. /// </value>
  18. public Action<DbContextOptionsBuilder> ConfigureDbContext { get; set; }
  19. /// <summary>
  20. /// Callback in DI resolve the EF DbContextOptions. If set, ConfigureDbContext will not be used.
  21. /// </summary>
  22. /// <value>
  23. /// The configure database context.
  24. /// </value>
  25. public Action<IServiceProvider, DbContextOptionsBuilder> ResolveDbContextOptions { get; set; }
  26. /// <summary>
  27. /// Gets or sets the default schema.
  28. /// </summary>
  29. /// <value>
  30. /// The default schema.
  31. /// </value>
  32. public string DefaultSchema { get; set; } = null;
  33. /// <summary>
  34. /// Gets or sets the persisted grants table configuration.
  35. /// </summary>
  36. /// <value>
  37. /// The persisted grants.
  38. /// </value>
  39. public TableConfiguration PersistedGrants { get; set; } = new TableConfiguration("PersistedGrants");
  40. /// <summary>
  41. /// Gets or sets the device flow codes table configuration.
  42. /// </summary>
  43. /// <value>
  44. /// The device flow codes.
  45. /// </value>
  46. public TableConfiguration DeviceFlowCodes { get; set; } = new TableConfiguration("DeviceCodes");
  47. /// <summary>
  48. /// Gets or sets a value indicating whether stale entries will be automatically cleaned up from the database.
  49. /// This is implemented by perodically connecting to the database (according to the TokenCleanupInterval) from the hosting application.
  50. /// Defaults to false.
  51. /// </summary>
  52. /// <value>
  53. /// <c>true</c> if [enable token cleanup]; otherwise, <c>false</c>.
  54. /// </value>
  55. public bool EnableTokenCleanup { get; set; } = false;
  56. /// <summary>
  57. /// Gets or sets the token cleanup interval (in seconds). The default is 3600 (1 hour).
  58. /// </summary>
  59. /// <value>
  60. /// The token cleanup interval.
  61. /// </value>
  62. public int TokenCleanupInterval { get; set; } = 3600;
  63. /// <summary>
  64. /// Gets or sets the number of records to remove at a time. Defaults to 100.
  65. /// </summary>
  66. /// <value>
  67. /// The size of the token cleanup batch.
  68. /// </value>
  69. public int TokenCleanupBatchSize { get; set; } = 100;
  70. }
  71. }