Exemple #1
0
        /// <summary>
        /// Configures EF implementation of IPersistedGrantStore with IdentityServer.
        /// </summary>
        /// <typeparam name="TContext">The IPersistedGrantDbContext to use.</typeparam>
        /// <param name="builder">The builder.</param>
        /// <param name="storeOptionsAction">The store options action.</param>
        /// <returns></returns>
        public static IIdentityServerBuilder AddOperationalStore <TContext>(
            this IIdentityServerBuilder builder,
            Action <OperationalStoreOptions> storeOptionsAction = null)
            where TContext : DbContext, IPersistedGrantDbContext
        {
            builder.Services.AddOperationalDbContext <TContext>(storeOptionsAction);

            builder.AddSigningKeyStore <SigningKeyStore>();
            builder.AddPersistedGrantStore <PersistedGrantStore>();
            builder.AddDeviceFlowStore <DeviceFlowStore>();

            builder.Services.AddSingleton <IHostedService, TokenCleanupHost>();

            return(builder);
        }
Exemple #2
0
        /// <summary>
        /// 注入对象存储   使用mongodb实现
        /// </summary>
        public static IIdentityServerBuilder AddMongoDBConfigurationStore(
            this IIdentityServerBuilder builder, Action <IdentityServerMongoContext> context)
        {
            //注入mongo存储
            builder.Services.AddMongoServices()
            .AddMongoContext(context);

            //注入替换的服务
            builder.AddClientStore <ClientStore>();
            builder.AddResourceStore <ResourceStore>();
            builder.AddCorsPolicyService <CorsPolicyService>();
            builder.AddPersistedGrantStore <PersistedGrantStore>();
            builder.AddDeviceFlowStore <DeviceFlowStore>();

            return(builder);
        }
 public static IIdentityServerBuilder AddOperationalStore(this IIdentityServerBuilder builder)
 {
     builder.AddPersistedGrantStore <PersistedGrantStore>();
     builder.AddDeviceFlowStore <DeviceFlowStore>();
     return(builder);
 }