Esempio n. 1
0
    /// <summary>
    /// Adds the pluggable services.
    /// </summary>
    /// <param name="builder">The builder.</param>
    /// <returns></returns>
    public static IIdentityServerBuilder AddPluggableServices(this IIdentityServerBuilder builder)
    {
        builder.Services.TryAddTransient <ICancellationTokenProvider, DefaultHttpContextCancellationTokenICancellationTokenProvider>();
        builder.Services.TryAddTransient <IPersistedGrantService, DefaultPersistedGrantService>();
        builder.Services.TryAddTransient <IKeyMaterialService, DefaultKeyMaterialService>();
        builder.Services.TryAddTransient <ITokenService, DefaultTokenService>();
        builder.Services.TryAddTransient <ITokenCreationService, DefaultTokenCreationService>();
        builder.Services.TryAddTransient <IClaimsService, DefaultClaimsService>();
        builder.Services.TryAddTransient <IRefreshTokenService, DefaultRefreshTokenService>();
        builder.Services.TryAddTransient <IDeviceFlowCodeService, DefaultDeviceFlowCodeService>();
        builder.Services.TryAddTransient <IConsentService, DefaultConsentService>();
        builder.Services.TryAddTransient <ICorsPolicyService, DefaultCorsPolicyService>();
        builder.Services.TryAddTransient <IProfileService, DefaultProfileService>();
        builder.Services.TryAddTransient <IConsentMessageStore, ConsentMessageStore>();
        builder.Services.TryAddTransient <IMessageStore <LogoutMessage>, ProtectedDataMessageStore <LogoutMessage> >();
        builder.Services.TryAddTransient <IMessageStore <LogoutNotificationContext>, ProtectedDataMessageStore <LogoutNotificationContext> >();
        builder.Services.TryAddTransient <IMessageStore <ErrorMessage>, ProtectedDataMessageStore <ErrorMessage> >();
        builder.Services.TryAddTransient <IIdentityServerInteractionService, DefaultIdentityServerInteractionService>();
        builder.Services.TryAddTransient <IDeviceFlowInteractionService, DefaultDeviceFlowInteractionService>();
        builder.Services.TryAddTransient <IBackchannelAuthenticationInteractionService, DefaultBackchannelAuthenticationInteractionService>();
        builder.Services.TryAddTransient <IAuthorizationCodeStore, DefaultAuthorizationCodeStore>();
        builder.Services.TryAddTransient <IRefreshTokenStore, DefaultRefreshTokenStore>();
        builder.Services.TryAddTransient <IReferenceTokenStore, DefaultReferenceTokenStore>();
        builder.Services.TryAddTransient <IUserConsentStore, DefaultUserConsentStore>();
        builder.Services.TryAddTransient <IBackChannelAuthenticationRequestStore, DefaultBackChannelAuthenticationRequestStore>();
        builder.Services.TryAddTransient <IHandleGenerationService, DefaultHandleGenerationService>();
        builder.Services.TryAddTransient <IPersistentGrantSerializer, PersistentGrantSerializer>();
        builder.Services.TryAddTransient <IEventService, DefaultEventService>();
        builder.Services.TryAddTransient <IEventSink, DefaultEventSink>();
        builder.Services.TryAddTransient <IUserCodeService, DefaultUserCodeService>();
        builder.Services.TryAddTransient <IUserCodeGenerator, NumericUserCodeGenerator>();
        builder.Services.TryAddTransient <ILogoutNotificationService, LogoutNotificationService>();
        builder.Services.TryAddTransient <IBackChannelLogoutService, DefaultBackChannelLogoutService>();
        builder.Services.TryAddTransient <IResourceValidator, DefaultResourceValidator>();
        builder.Services.TryAddTransient <IScopeParser, DefaultScopeParser>();
        builder.Services.TryAddTransient <ISessionCoordinationService, DefaultSessionCoordinationService>();

        builder.Services.TryAddTransient <IBackchannelAuthenticationThrottlingService, DistributedBackchannelAuthenticationThrottlingService>();
        builder.Services.TryAddTransient <IBackchannelAuthenticationUserNotificationService, NopBackchannelAuthenticationUserNotificationService>();

        builder.AddJwtRequestUriHttpClient();
        builder.AddBackChannelLogoutHttpClient();

        builder.Services.AddTransient <IClientSecretValidator, ClientSecretValidator>();
        builder.Services.AddTransient <IApiSecretValidator, ApiSecretValidator>();

        builder.Services.TryAddTransient <IDeviceFlowThrottlingService, DistributedDeviceFlowThrottlingService>();
        builder.Services.AddDistributedMemoryCache();

        return(builder);
    }