Skip to content

Commit

Permalink
Rename TodoClient to AuthClient
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed May 14, 2023
1 parent 0a81ea1 commit 478195d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Todo.Web/Server/AuthApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static RouteGroupBuilder MapAuth(this IEndpointRouteBuilder routes)
{
var group = routes.MapGroup("/auth");

group.MapPost("register", async (UserInfo userInfo, TodoClient client) =>
group.MapPost("register", async (UserInfo userInfo, AuthClient client) =>
{
// Retrieve the access token given the user info
var token = await client.CreateUserAsync(userInfo);
Expand All @@ -23,7 +23,7 @@ public static RouteGroupBuilder MapAuth(this IEndpointRouteBuilder routes)
return SignIn(userInfo, token);
});

group.MapPost("login", async (UserInfo userInfo, TodoClient client) =>
group.MapPost("login", async (UserInfo userInfo, AuthClient client) =>
{
// Retrieve the access token give the user info
var token = await client.GetTokenAsync(userInfo);
Expand Down Expand Up @@ -60,7 +60,7 @@ public static RouteGroupBuilder MapAuth(this IEndpointRouteBuilder routes)
authenticationSchemes: new[] { provider });
});

group.MapGet("signin/{provider}", async (string provider, TodoClient client, HttpContext context) =>
group.MapGet("signin/{provider}", async (string provider, AuthClient client, HttpContext context) =>
{
// Grab the login information from the external login dance
var result = await context.AuthenticateAsync(AuthConstants.ExternalScheme);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace Todo.Web.Server;

public class TodoClient
public class AuthClient
{
private readonly HttpClient _client;

public TodoClient(HttpClient client)
public AuthClient(HttpClient client)
{
_client = client;
}
Expand Down
2 changes: 1 addition & 1 deletion Todo.Web/Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
throw new InvalidOperationException("Todo API URL is not configured");

// Configure the HttpClient for the backend API
builder.Services.AddHttpClient<TodoClient>(client =>
builder.Services.AddHttpClient<AuthClient>(client =>
{
client.BaseAddress = new(todoUrl);
});
Expand Down

0 comments on commit 478195d

Please sign in to comment.