예제 #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);
        }
 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
 public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
 {
     Scheme = scheme;
     return(Task.CompletedTask);
 }