/// <summary></summary>
        /// <param name="context"></param>
        /// <param name="authenticationTypes"></param>
        public static void Challenge(this HttpContextBase context, string authenticationType, AuthenticationExtra extra)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            OwinResponse response = GetOwinResponse(context);

            response.Challenge(new[] { authenticationType }, extra);
        }
        /// <summary></summary>
        /// <param name="context"></param>
        /// <param name="authenticationTypes"></param>
        public static void Challenge(this HttpContext context, params string[] authenticationTypes)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            OwinResponse response = GetOwinResponse(context);

            response.Challenge(authenticationTypes);
        }
Beispiel #3
0
        public void WithExtraDataMeansChallengesAreDeterminedOnlyByMatchingAuthenticationType()
        {
            var request  = OwinRequest.Create();
            var response = new OwinResponse(request);
            var helper   = new SecurityHelper(request);

            response.Challenge(new[] { "Beta", "Gamma" });

            var activeNoMatch  = helper.LookupChallenge("Alpha", AuthenticationMode.Active);
            var passiveNoMatch = helper.LookupChallenge("Alpha", AuthenticationMode.Passive);

            response.Challenge(new[] { "Beta", "Alpha" });

            var activeWithMatch  = helper.LookupChallenge("Alpha", AuthenticationMode.Active);
            var passiveWithMatch = helper.LookupChallenge("Alpha", AuthenticationMode.Passive);

            activeNoMatch.ShouldBe(null);
            passiveNoMatch.ShouldBe(null);
            activeWithMatch.ShouldNotBe(null);
            passiveWithMatch.ShouldNotBe(null);
        }
        /// <summary></summary>
        /// <param name="context"></param>
        /// <param name="authenticationTypes"></param>
        /// <param name="extra"></param>
        public static void Challenge(this HttpContext context, string[] authenticationTypes, AuthenticationExtra extra)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (extra == null)
            {
                throw new ArgumentNullException("extra");
            }

            OwinResponse response = GetOwinResponse(context);

            response.Challenge(authenticationTypes, extra);
        }
 public void Challenge(AuthenticationExtra extra, params string[] authenticationTypes)
 {
     _response.Challenge(authenticationTypes, extra);
 }