예제 #1
0
 public TokenActions(
     RuntimeSettings simpleAuthOptions,
     IAuthorizationCodeStore authorizationCodeStore,
     IClientStore clientStore,
     IScopeStore scopeRepository,
     IJwksStore jwksStore,
     IResourceOwnerRepository resourceOwnerRepository,
     IEnumerable <IAuthenticateResourceOwnerService> resourceOwnerServices,
     IEventPublisher eventPublisher,
     ITokenStore tokenStore,
     IDeviceAuthorizationStore deviceAuthorizationStore,
     ILogger logger)
 {
     _getTokenByDeviceAuthorizationTypeAction = new GetTokenByDeviceAuthorizationTypeAction(
         deviceAuthorizationStore,
         tokenStore,
         jwksStore,
         clientStore,
         eventPublisher,
         logger);
     _getTokenByResourceOwnerCredentialsGrantType = new GetTokenByResourceOwnerCredentialsGrantTypeAction(
         clientStore,
         scopeRepository,
         tokenStore,
         jwksStore,
         resourceOwnerServices,
         eventPublisher,
         logger);
     _getTokenByAuthorizationCodeGrantTypeAction = new GetTokenByAuthorizationCodeGrantTypeAction(
         authorizationCodeStore,
         simpleAuthOptions,
         clientStore,
         eventPublisher,
         tokenStore,
         jwksStore);
     _getTokenByRefreshTokenGrantTypeAction = new GetTokenByRefreshTokenGrantTypeAction(
         eventPublisher,
         tokenStore,
         jwksStore,
         resourceOwnerRepository,
         clientStore);
     _authenticateClient = new AuthenticateClient(clientStore, jwksStore);
     _revokeTokenAction  = new RevokeTokenAction(clientStore, tokenStore, jwksStore, logger);
     _jwksStore          = jwksStore;
     _eventPublisher     = eventPublisher;
     _tokenStore         = tokenStore;
 }
 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);
 }