コード例 #1
0
        protected virtual bool IsSocialAuthConfigured(Microsoft.AspNetCore.Authentication.AuthenticationScheme scheme)
        {
            if (CustomSocialAuthSchemes.Schemes.Contains(scheme.Name))
            {
                return(true);
            }

            switch (scheme.Name)
            {
            case "Microsoft":
                if (!string.IsNullOrWhiteSpace(UserManager.Site.MicrosoftClientId))
                {
                    return(true);
                }
                break;

            case "Google":
                if (!string.IsNullOrWhiteSpace(UserManager.Site.GoogleClientId))
                {
                    return(true);
                }
                break;

            case "Facebook":
                if (!string.IsNullOrWhiteSpace(UserManager.Site.FacebookAppId))
                {
                    return(true);
                }
                break;

            case "Twitter":
                if (!string.IsNullOrWhiteSpace(UserManager.Site.TwitterConsumerKey))
                {
                    return(true);
                }
                break;

            case "OpenIdConnect":
                if (!string.IsNullOrWhiteSpace(UserManager.Site.OidConnectAppId))
                {
                    return(true);
                }
                break;
            }

            return(false);
        }
コード例 #2
0
 public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
 {
     return(Task.FromResult(0));
 }
コード例 #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="scheme">The authentication scheme.</param>
 /// <param name="options">The authentication options associated with the scheme.</param>
 /// <param name="properties">The authentication properties.</param>
 protected PrincipalContext(HttpContext context, AuthenticationScheme scheme, TOptions options, AuthenticationProperties?properties)
     : base(context, scheme, options, properties)
 {
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of <see cref="ResultContext{TOptions}"/>.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="scheme">The authentication scheme.</param>
 /// <param name="options">The authentication options associated with the scheme.</param>
 protected ResultContext(HttpContext context, AuthenticationScheme scheme, TOptions options)
     : base(context, scheme, options)
 {
 }
コード例 #5
0
ファイル: PolicyTests.cs プロジェクト: shat90/aspnetcore
 public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
 {
     Scheme = scheme;
     return(Task.CompletedTask);
 }