15 lines
		
	
	
		
			474 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			474 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Microsoft.Extensions.DependencyInjection;
 | |
| 
 | |
| namespace JWTService.Extensions {
 | |
|   public static class ServiceCollectionExtensions {
 | |
|     public static void RegisterJWTService(this IServiceCollection services, IJWTServiceConfig appSettings) {
 | |
|       var config = appSettings.JwtConfig;
 | |
| 
 | |
|       if(config == null) throw new NullReferenceException();
 | |
| 
 | |
|       services.AddSingleton<IJwtConfig>(x => config);
 | |
|       services.AddSingleton<IJWTService, JWTService>();
 | |
|     }
 | |
|   }
 | |
| }
 |