Exemplo n.º 1
0
    public async Task Authenticated_User_with_restricted_current_Idp_with_prompt_none_must_error()
    {
        var request = new ValidatedAuthorizeRequest
        {
            ClientId = "foo",
            Subject  = new IdentityServerUser("123")
            {
                IdentityProvider = IdentityServerConstants.LocalIdentityProvider
            }.CreatePrincipal(),
            Client = new Client
            {
                EnableLocalLogin             = false,
                IdentityProviderRestrictions = new List <string>
                {
                    "some_idp"
                }
            },
            PromptModes = new[] { PromptModes.None },
        };

        var result = await _subject.ProcessInteractionAsync(request);

        result.IsError.Should().BeTrue();
        result.IsLogin.Should().BeFalse();
    }
    public async Task Authenticated_User_must_not_SignIn()
    {
        var request = new ValidatedAuthorizeRequest
        {
            ClientId           = "foo",
            Client             = new Client(),
            ValidatedResources = new ResourceValidationResult(),
            Subject            = new IdentityServerUser("123")
            {
                IdentityProvider = IdentityServerConstants.LocalIdentityProvider
            }.CreatePrincipal()
        };

        var result = await _subject.ProcessInteractionAsync(request);

        result.IsLogin.Should().BeFalse();
    }