24 lines
658 B
C#
24 lines
658 B
C#
using Microsoft.AspNetCore.Authentication;
|
|
using Microsoft.AspNetCore.Authentication.Google;
|
|
|
|
namespace Hutopy.Web.Endpoints;
|
|
|
|
public class Google : EndpointGroupBase
|
|
{
|
|
public override void Map(WebApplication app)
|
|
{
|
|
app.MapGroup(this)
|
|
.MapGet("/o/sign-in", Callback);
|
|
}
|
|
|
|
private static async Task Callback(ISender sender, HttpContext context)
|
|
{
|
|
await context.ChallengeAsync(GoogleDefaults.AuthenticationScheme,
|
|
new AuthenticationProperties
|
|
{
|
|
RedirectUri = "/signin-google",
|
|
ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30),
|
|
});
|
|
}
|
|
}
|