This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IUserService | |
| { | |
| Task<IReadOnlyCollection<User>> GetAllUsers(); | |
| Task UpdateUser(User userToUpdate); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AuthResponse | |
| { | |
| public string Token { get; set; } | |
| public DateTime Expiration { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ConfigureServices(IServiceCollectionservices) | |
| { | |
| services.AddMemoryCache(); | |
| services.AddHttpClient<IUserApiAuthenticationService, UserApiAuthenticationService>() | |
| .ConfigureHttpClient(c => c.BaseAddress ="http://urltotheuserapi.com"); | |
| services.AddTransient<UserApiAuthenticationHandler>(); | |
| services.AddHttpClient<UserService, UserService>() | |
| .ConfigureHttpClient(c => c.BaseAddress ="http://urltotheuserapi.com") | |
| .AddHttpMessageHandler<UserApiAuthenticationHanler>(); |
OlderNewer