public GenerateAuthorizationResponseFixture(ITestOutputHelper outputHelper) { IdentityModelEventSource.ShowPII = true; _authorizationCodeRepositoryFake = new Mock <IAuthorizationCodeStore>(); _tokenStore = new Mock <ITokenStore>(); _eventPublisher = new Mock <IEventPublisher>(); _eventPublisher.Setup(x => x.Publish(It.IsAny <TokenGranted>())).Returns(Task.CompletedTask); _clientStore = new Mock <IClientStore>(); _clientStore.Setup(x => x.GetAll(It.IsAny <CancellationToken>())).ReturnsAsync(Array.Empty <Client>()); _consentRepository = new Mock <IConsentRepository>(); var scopeRepository = new Mock <IScopeRepository>(); scopeRepository.Setup(x => x.SearchByNames(It.IsAny <CancellationToken>(), It.IsAny <string[]>())) .ReturnsAsync(new[] { new Scope { Name = "openid" } }); _inMemoryJwksRepository = new InMemoryJwksRepository(); _generateAuthorizationResponse = new GenerateAuthorizationResponse( _authorizationCodeRepositoryFake.Object, _tokenStore.Object, scopeRepository.Object, _clientStore.Object, _consentRepository.Object, _inMemoryJwksRepository, _eventPublisher.Object, new TestOutputLogger("test", outputHelper)); }
public AuthorizationPolicyValidatorFixture() { IdentityModelEventSource.ShowPII = true; _resourceSetRepositoryStub = new Mock <IResourceSetRepository>(); _clientStoreStub = new Mock <IClientStore>(); _inMemoryJwksRepository = new InMemoryJwksRepository(); _authorizationPolicyValidator = new AuthorizationPolicyValidator( _inMemoryJwksRepository, _resourceSetRepositoryStub.Object, new Mock <IEventPublisher>().Object); }
private void InitializeFakeObjects(TimeSpan authorizationCodeValidity = default) { _eventPublisher = new Mock <IEventPublisher>(); _authorizationCodeStoreFake = new Mock <IAuthorizationCodeStore>(); _tokenStoreFake = new Mock <ITokenStore>(); _clientStore = new Mock <IClientStore>(); _simpleAuthOptions = new RuntimeSettings( authorizationCodeValidityPeriod: authorizationCodeValidity == default ? TimeSpan.FromSeconds(3600) : authorizationCodeValidity); _inMemoryJwksRepository = new InMemoryJwksRepository(); _getTokenByAuthorizationCodeGrantTypeAction = new GetTokenByAuthorizationCodeGrantTypeAction( _authorizationCodeStoreFake.Object, _simpleAuthOptions, _clientStore.Object, _eventPublisher.Object, _tokenStoreFake.Object, _inMemoryJwksRepository); }
public InMemoryJwksRepositoryFixture() { _repository = new InMemoryJwksRepository(); }