Exemplo n.º 1
0
 public void When_get_authentication_manager_and_throw_on_null_then_should_throw()
 {
     Assert.Throws <InvalidOperationException>(() => _nancyContext.GetAuthenticationManager(true));
 }
Exemplo n.º 2
0
 public void When_get_authentication_manager_should_not_be_null()
 {
     _nancyContext.GetAuthenticationManager().Should().NotBeNull();
 }
        /// <summary>
        ///     Get the user from the Micrososft owin user from the nancy context.
        /// </summary>
        /// <param name="context">The current nancy context.</param>
        /// <returns>Returns the current user for the request.</returns>
        public static ClaimsPrincipal GetMSOwinUser(this NancyContext context)
        {
            IAuthenticationManager authenticationManager = context.GetAuthenticationManager(true);

            return(authenticationManager.User);
        }