-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAspNetCoreServiceCollectionExtensions.cs
More file actions
48 lines (45 loc) · 2.28 KB
/
AspNetCoreServiceCollectionExtensions.cs
File metadata and controls
48 lines (45 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using Microsoft.Extensions.DependencyInjection;
using P7Core.Extensions;
using TokenExchange.Contracts.Services;
using TokenExchange.Contracts.Stores;
using Utils;
namespace TokenExchange.Contracts.Extensions
{
public static class AspNetCoreServiceCollectionExtensions
{
public static IServiceCollection AddTokenExchangeContracts(this IServiceCollection services)
{
services.AddTransient<ITokenExchangeHandlerPreProcessor, ValidateAndStripSignatureTokenExchangeHandlerPreProcessor>();
services.AddTransient<ITokenExchangeHandlerPreProcessor, StripSignatureTokenExchangeHandlerPreProcessor>();
services.AddTransient<ITokenExchangeHandlerPreProcessorStore, TokenExchangeHandlerPreProcessorStore>();
services.AddTransient<OIDCTokenValidator>();
services.AddTransient<ITokenExchangeHandlerRouter, TokenExchangeHandlerRouter>();
services.AddTransient<IPipelineTokenExchangeHandlerRouter, TokenExchangeHandlerRouter>();
return services;
}
public static IServiceCollection AddDemoTokenExchangeHandlers(this IServiceCollection services)
{
services.AddLazyTransient<ITokenExchangeHandler, GoogleMyCustomIdentityTokenExchangeHandler>();
services.AddLazyTransient<ITokenExchangeHandler, AlienCustomIdentityTokenExchangeHandler>();
return services;
}
public static IServiceCollection AddSelfTokenExchangeHandler(this IServiceCollection services)
{
services.AddLazyTransient<ITokenExchangeHandler, SelfIdentityTokenExchangeHandler>();
return services;
}
public static IServiceCollection AddInMemoryExternalExchangeStore(this IServiceCollection services)
{
services.AddTransient<ExternalExchangeTokenExchangeHandler>();
services.AddSingleton<IExternalExchangeStore, InMemoryExternalExchangeStore>();
return services;
}
public static IServiceCollection AddInMemoryPipelineExchangeStore(this IServiceCollection services)
{
services.AddTransient<PipelineTokenExchangeHandler>();
services.AddSingleton<IPipelineExchangeStore, InMemoryPipelineExchangeStore>();
return services;
}
}
}