Example #1
0
 public JwtBuilder(IHttpClientFactory httpClientFactory, IJsonWebKeyQueryRepository jsonWebKeyRepository, IJwsGenerator jwsGenerator, IJweGenerator jweGenerator)
 {
     _httpClientFactory    = httpClientFactory;
     _jsonWebKeyRepository = jsonWebKeyRepository;
     _jwsGenerator         = jwsGenerator;
     _jweGenerator         = jweGenerator;
 }
Example #2
0
        private void InitializeFakeObjects()
        {
            var services = new ServiceCollection();

            services.AddSimpleIdentityServerJwt();
            var provider = services.BuildServiceProvider();

            _jwsGenerator             = (IJwsGenerator)provider.GetService(typeof(IJwsGenerator));
            _jweGenerator             = (IJweGenerator)provider.GetService(typeof(IJweGenerator));
            _httpClientFactoryStub    = new Mock <IHttpClientFactory>();
            _smsHttpClientFactoryStub = new Mock <IHttpClientFactory>();
            var requestBuilder          = new RequestBuilder();
            var postTokenOperation      = new PostTokenOperation(_httpClientFactoryStub.Object);
            var getDiscoveryOperation   = new GetDiscoveryOperation(_httpClientFactoryStub.Object);
            var introspectionOperation  = new IntrospectOperation(_httpClientFactoryStub.Object);
            var revokeTokenOperation    = new RevokeTokenOperation(_httpClientFactoryStub.Object);
            var sendSmsOperation        = new SendSmsOperation(_smsHttpClientFactoryStub.Object);
            var getJsonWebKeysOperation = new GetJsonWebKeysOperation(_httpClientFactoryStub.Object);

            _clientAuthSelector = new ClientAuthSelector(
                new TokenClientFactory(postTokenOperation, getDiscoveryOperation),
                new IntrospectClientFactory(introspectionOperation, getDiscoveryOperation),
                new RevokeTokenClientFactory(revokeTokenOperation, getDiscoveryOperation));
            var getUserInfoOperation = new GetUserInfoOperation(_httpClientFactoryStub.Object);

            _sidSmsAuthenticateClient = new SidSmsAuthenticateClient(sendSmsOperation);
            _userInfoClient           = new UserInfoClient(getUserInfoOperation, getDiscoveryOperation);
            _jwksClient = new JwksClient(getJsonWebKeysOperation, getDiscoveryOperation);
        }
 public CreateJweAction(
     IJweGenerator jweGenerator,
     IJsonWebKeyHelper jsonWebKeyHelper)
 {
     _jweGenerator     = jweGenerator;
     _jsonWebKeyHelper = jsonWebKeyHelper;
 }
Example #4
0
 public JwtParser(
     IJweGenerator jweGenerator,
     IJwsGenerator jwsGenerator,
     IHttpClientFactory httpClientFactory,
     IOAuthClientQueryRepository oauthClientRepository,
     IJsonWebKeyQueryRepository jsonWebKeyRepository)
 {
     _jweGenerator          = jweGenerator;
     _jwsGenerator          = jwsGenerator;
     _httpClientFactory     = httpClientFactory;
     _oauthClientRepository = oauthClientRepository;
     _jsonWebKeyRepository  = jsonWebKeyRepository;
 }
 private void InitializeFakeObjects()
 {
     _jweGenerator = new JweGenerator(new IEncHandler[]
     {
         new A128CBCHS256EncHandler(),
         new A192CBCHS384EncHandler(),
         new A256CBCHS512EncHandler(),
     }, new ICEKHandler[]
     {
         new RSA15CEKHandler(),
         new RSAOAEP256CEKHandler(),
         new RSAOAEPCEKHandler()
     });
 }
Example #6
0
 public JwtGenerator(
     IConfigurationService configurationService,
     IClientRepository clientRepository,
     IClientValidator clientValidator,
     IJsonWebKeyRepository jsonWebKeyRepository,
     IScopeRepository scopeRepository,
     IClaimsMapping claimsMapping,
     IParameterParserHelper parameterParserHelper,
     IJwsGenerator jwsGenerator,
     IJweGenerator jweGenerator)
 {
     _configurationService  = configurationService;
     _clientRepository      = clientRepository;
     _clientValidator       = clientValidator;
     _jsonWebKeyRepository  = jsonWebKeyRepository;
     _scopeRepository       = scopeRepository;
     _claimsMapping         = claimsMapping;
     _parameterParserHelper = parameterParserHelper;
     _jwsGenerator          = jwsGenerator;
     _jweGenerator          = jweGenerator;
 }
Example #7
0
        private void InitializeFakeObjects()
        {
            var services = new ServiceCollection();

            services.AddSimpleIdentityServerJwt();
            var provider = services.BuildServiceProvider();

            _jwsGenerator          = (IJwsGenerator)provider.GetService(typeof(IJwsGenerator));
            _jweGenerator          = (IJweGenerator)provider.GetService(typeof(IJweGenerator));
            _httpClientFactoryStub = new Mock <IHttpClientFactory>();
            var getAuthorizationOperation = new GetAuthorizationOperation(_httpClientFactoryStub.Object);
            var getDiscoveryOperation     = new GetDiscoveryOperation(_httpClientFactoryStub.Object);
            var postTokenOperation        = new PostTokenOperation(_httpClientFactoryStub.Object);
            var introspectionOperation    = new IntrospectOperation(_httpClientFactoryStub.Object);
            var revokeTokenOperation      = new RevokeTokenOperation(_httpClientFactoryStub.Object);

            _authorizationClient = new AuthorizationClient(getAuthorizationOperation, getDiscoveryOperation);
            _clientAuthSelector  = new ClientAuthSelector(
                new TokenClientFactory(postTokenOperation, getDiscoveryOperation),
                new IntrospectClientFactory(introspectionOperation, getDiscoveryOperation),
                new RevokeTokenClientFactory(revokeTokenOperation, getDiscoveryOperation));
        }