Exemplo n.º 1
0
    public void Challenge_ResultHasCorrectValues(AuthenticationProperties properties, IList <string> authenticationSchemes)
    {
        // Act
        var result = TypedResults.Challenge(properties, authenticationSchemes);

        // Assert
        Assert.Equal(properties, result.Properties);
        Assert.Equal(authenticationSchemes ?? new ReadOnlyCollection <string>(new List <string>()), result.AuthenticationSchemes);
    }
Exemplo n.º 2
0
 /// <summary>
 /// Creates an <see cref="IResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.ChallengeAsync(HttpContext, string?, AuthenticationProperties?)" />.
 /// <para>
 /// The behavior of this method depends on the <see cref="IAuthenticationService"/> in use.
 /// <see cref="StatusCodes.Status401Unauthorized"/> and <see cref="StatusCodes.Status403Forbidden"/>
 /// are among likely status results.
 /// </para>
 /// </summary>
 /// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the authentication
 /// challenge.</param>
 /// <param name="authenticationSchemes">The authentication schemes to challenge.</param>
 /// <returns>The created <see cref="IResult"/> for the response.</returns>
 public static IResult Challenge(
     AuthenticationProperties?properties  = null,
     IList <string>?authenticationSchemes = null)
 => TypedResults.Challenge(properties, authenticationSchemes);