Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
 public void Challenge(AuthenticationExtra extra, params string[] authenticationTypes)
 {
     _response.Challenge(authenticationTypes, extra);
 }