summaryrefslogtreecommitdiffstats
path: root/src/server/Api/Internal/Account/CreateGithubSessionRoute.cs
blob: b13cff7807c545a3cb930376b41ab90e356d44f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using AspNet.Security.OAuth.GitHub;

namespace IOL.BookmarkThing.Server.Api.Internal.Account;

public class CreateGithubSessionRoute : RouteBaseInternalSync.WithoutRequest.WithActionResult
{
	private readonly IConfiguration _configuration;

	public CreateGithubSessionRoute(IConfiguration configuration) {
		_configuration = configuration;
	}

	[AllowAnonymous]
	[ApiVersionNeutral]
	[ApiExplorerSettings(IgnoreApi = true)]
	[HttpGet("~/v{version:apiVersion}/account/create-github-session")]
	public override ActionResult Handle() {
		return Challenge(new AuthenticationProperties {
								 RedirectUri = _configuration.GetValue<string>("FRONTEND_CANONICAL_URL"),
						 },
						 GitHubAuthenticationDefaults.AuthenticationScheme);
	}
}