Beginnings of Core Auth
This commit is contained in:
57
RelayCore/Endpoints/AuthEndpoints.cs
Normal file
57
RelayCore/Endpoints/AuthEndpoints.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using RelayCore.Services;
|
||||
|
||||
namespace RelayCore.Endpoints;
|
||||
|
||||
public static class AuthEndpoints
|
||||
{
|
||||
public static void MapAuthEndpoints(this WebApplication app)
|
||||
{
|
||||
app.MapPost("/user/signin", async (AuthSignin request, APIAuthService service) =>
|
||||
{
|
||||
var token = await service.UserSigninAsync(request);
|
||||
|
||||
return token != null ? Results.Ok(token) : Results.Unauthorized();
|
||||
});
|
||||
app.MapPost("/user/register", async (AuthRegister request, APIAuthService service) =>
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return Results.Ok();
|
||||
});
|
||||
app.MapPost("/server/verify/user", async (AuthUserVerify request, APIAuthService service) =>
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
});
|
||||
app.MapPost("/server/user/profile", async (AuthUserVerify request, APIAuthService service) =>
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
});
|
||||
app.MapPost("/server/verify/license", async (AuthServerLicense request, APIAuthService service) =>
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class AuthSignin
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
public class AuthRegister
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Email { get; set; }
|
||||
}
|
||||
|
||||
public class AuthUserVerify
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Token { get; set; }
|
||||
}
|
||||
|
||||
public class AuthServerLicense
|
||||
{
|
||||
public string License { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user