public void When_get_authentication_manager_and_throw_on_null_then_should_throw() { Assert.Throws <InvalidOperationException>(() => _nancyContext.GetAuthenticationManager(true)); }
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); }