Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

37 lines
1.2 KiB

// ==========================================================================
// GithubIdentityUsage.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using AspNet.Security.OAuth.GitHub;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace Squidex.Config.Identity
{
public static class GitHubIdentityUsage
{
public static IApplicationBuilder UseMyGithubAuthentication(this IApplicationBuilder app)
{
var options = app.ApplicationServices.GetService<IOptions<MyIdentityOptions>>().Value;
if (options.IsGithubAuthConfigured())
{
var githubOptions =
new GitHubAuthenticationOptions
{
ClientId = options.GithubClient,
ClientSecret = options.GithubSecret
};
app.UseGitHubAuthentication(githubOptions);
}
return app;
}
}
}