Beispiel #1
0
        public Task ChallengeAsync(HttpAuthenticationChallengeContext context, CancellationToken cancellationToken)
        {
            string parameter = "scopes=\"" + string.Join(",", requiredScopes) + "\"";

            context.ChallengeWith("Bearer", parameter);
            return(Task.FromResult(0));
        }
 public static void ChallengeWith(
     this HttpAuthenticationChallengeContext context,
     string scheme,
     string parameter)
 {
     context.ChallengeWith(new AuthenticationHeaderValue(scheme, parameter));
 }
Beispiel #3
0
        private void Challenge(HttpAuthenticationChallengeContext context)
        {
            string parameter;

            parameter = string.IsNullOrEmpty(Realm) ? null : "realm=\"" + Realm + "\"";

            context.ChallengeWith("Basic", parameter);
        }
Beispiel #4
0
        private void Challenge(HttpAuthenticationChallengeContext context)
        {
            string parameter = null;

            if (!string.IsNullOrEmpty(Realm))
                parameter = "realm=\"" + Realm + "\"";

            context.ChallengeWith("Bearer", parameter);
        }
Beispiel #5
0
        /// <summary>
        /// Challenges the context for this realm
        /// </summary>
        /// <param name="context"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task ChallengeAsync(HttpAuthenticationChallengeContext context, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            context.ChallengeWith(
                _schemeId,
                String.IsNullOrWhiteSpace(Realm) ? null : "realm=\"" + Realm + "\"");

            return(Task.FromResult(0));
        }
Beispiel #6
0
        private void ChallengeAsync(HttpAuthenticationChallengeContext context)
        {
            string parameter = null;

            if (!string.IsNullOrEmpty(Realm))
            {
                parameter = "realm=\"" + Realm + "\"";
            } // token的parameter部分已经通过jwt验证成功,这里只需要验证scheme即可
            context.ChallengeWith("Bearer", parameter); // 这个自定义扩展方法定义在HttpAuthenticationChallengeContextExtensions.cs文件中
                                                        // 主要用来验证token的Schema是不是Bearer
        }
        public Task ChallengeAsync(HttpAuthenticationChallengeContext context, CancellationToken cancellationToken)
        {
            //此方法在AuthenticateAsync方法调用完成之后自动调用
            string parameter = null;

            if (!string.IsNullOrEmpty(Realm))
            {
                parameter = "realm=\"" + Realm + "\"";
            }
            context.ChallengeWith("Bearer", parameter); // 验证token的Schema是不是Bearer
            return(Task.FromResult(""));
        }
Beispiel #8
0
        private void Challenge(HttpAuthenticationChallengeContext context)
        {
            string parameter;

            if (String.IsNullOrEmpty(Realm))
            {
                parameter = null;
            }
            else
            {
                parameter = "realm=\"" + Realm + "\"";
            }

            context.ChallengeWith("Basic", parameter);
        }
Beispiel #9
0
        private void Challange(HttpAuthenticationChallengeContext context)
        {
            string parameter;

            if (string.IsNullOrEmpty(Realm))
            {
                parameter = null;
            }
            else
            {
                // A correct implementation should verify that Realm does not contain a quote character unless properly
                // escaped (precededed by a backslash that is not itself escaped).
                parameter = "realm=\"" + Realm + "\"";
            }
            context.ChallengeWith("Basic", parameter);
        }
        private void Challenge(HttpAuthenticationChallengeContext context)
        {
            string parameter;

            if (String.IsNullOrEmpty(Realm))
            {
                parameter = null;
            }
            else
            {
                // A correct implementation should verify that Realm does not contain a quote character unless properly
                // escaped (precededed by a backslash that is not itself escaped).
                //parameter = "realm=\"" + Realm + "\"";
                parameter = Realm;  //mod by JB to avoid browser's dreaded "Authentication Required" dialog box
            }

            context.ChallengeWith("Basic", parameter);
        }
 private void Challenge(HttpAuthenticationChallengeContext context)
 {
     context.ChallengeWith(AuthenticationScheme, null);
 }
 private void Challenge(HttpAuthenticationChallengeContext context)
 {
     context.ChallengeWith("Bearer");
 }
        /// <summary>
        /// Challenges the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        private void Challenge(HttpAuthenticationChallengeContext context)
        {
            var parameter = string.IsNullOrEmpty(Realm) ? null : $@"{REALM}="" + Realm + @""";

            context.ChallengeWith(AUTHORIZATION_BASIC, parameter);
        }
        public Task ChallengeAsync(HttpAuthenticationChallengeContext context, CancellationToken cancellationToken)
        {
            context.ChallengeWith(HmacAuthentication.AuthenticationScheme);

            return(Task.FromResult(0));
        }
Beispiel #15
0
        private void Challenge(HttpAuthenticationChallengeContext context)
        {
            string parameter = !string.IsNullOrEmpty(this.Realm) ? "realm=\"" + this.Realm + "\"" : (string)null;

            context.ChallengeWith("Basic", parameter);
        }