public async Task token_without_sub_should_fail() { var tokenResult = new TokenValidationResult { IsError = false, Client = await _clients.FindEnabledClientByIdAsync("codeclient"), Claims = new List <Claim>() }; var validator = new UserInfoRequestValidator( new TestTokenValidator(tokenResult), new TestProfileService(shouldBeActive: true), TestLogger.Create <UserInfoRequestValidator>()); var result = await validator.ValidateRequestAsync("token"); result.IsError.Should().BeTrue(); result.Error.Should().Be(OidcConstants.ProtectedResourceErrors.InvalidToken); }
public async Task active_user_should_succeed() { var tokenResult = new TokenValidationResult { IsError = false, Client = await _clients.FindEnabledClientByIdAsync("codeclient"), Claims = new List <Claim> { new Claim("sub", "123") }, }; var validator = new UserInfoRequestValidator( new TestTokenValidator(tokenResult), new TestProfileService(shouldBeActive: true), TestLogger.Create <UserInfoRequestValidator>()); var result = await validator.ValidateRequestAsync("token"); result.IsError.Should().BeFalse(); }