Exemple #1
0
 public GetFollowersQueryHandler(
     IOptions <ConnectionOptions> options,
     IOptions <GraphApiSettings> graphApiSettings)
 {
     this.graphApiSettings     = graphApiSettings.Value;
     this.readConnectionString = options.Value.SqlReader;
 }
Exemple #2
0
 public CreateNewUserRequestHandler(ICreateUserRepository repository,
                                    IOptions <GraphApiSettings> graphApiSettings,
                                    IEmailSender emailWrapper,
                                    IReaderSettingsRepository readersSettingsRepository)
 {
     this.repository   = repository;
     this.emailWrapper = emailWrapper;
     this.readersSettingsRepository = readersSettingsRepository;
     this.graphApiSettings          = graphApiSettings.Value;
 }
Exemple #3
0
        public void Setup()
        {
            _secureHttpRequest = new SecureHttpRequest();

            var config   = TestConfig.Instance.AzureAd;
            var settings = TestConfig.Instance.Settings;

            _graphApiSettings = new GraphApiSettings(new TokenProvider(config), config);
            _passwordService  = new PasswordService();
            _graphApiClient   = new GraphApiClient(_secureHttpRequest, _graphApiSettings, _passwordService, settings);
        }
Exemple #4
0
        public void TestInitialize()
        {
            _azureAdConfiguration = new AzureAdConfiguration()
            {
                ClientId        = "TestClientId",
                ClientSecret    = "TestSecret",
                Authority       = "https://Test/Authority",
                GraphApiBaseUri = "https://test.windows.net/"
            };

            _tokenProvider = new Mock <ITokenProvider>();
            _tokenProvider.Setup(t => t.GetClientAccessToken(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Token);

            _graphApiSettings = new GraphApiSettings(_tokenProvider.Object, _azureAdConfiguration);
        }
        public void Setup()
        {
            _createdAccount = null;

            _secureHttpRequest = new SecureHttpRequest();

            var settings      = TestConfig.Instance.Settings;
            var tokenProvider = new TokenProvider(TestConfig.Instance.AzureAd);

            _graphApiSettings         = new GraphApiSettings(tokenProvider, TestConfig.Instance.AzureAd);
            _passwordService          = new PasswordService();
            _identityServiceApiClient =
                new GraphApiClient(_secureHttpRequest, _graphApiSettings, _passwordService, settings);
            _distributedCache = new Mock <ICache>();
            _service          = new UserAccountService(_secureHttpRequest, _graphApiSettings, _identityServiceApiClient,
                                                       settings, _distributedCache.Object);
        }
        public void Setup()
        {
            SecureHttpRequest = new Mock <ISecureHttpRequest>();

            _settings = new Settings {
                IsLive  = true, ReformEmail = Domain.Replace("@", ""),
                AdGroup = new AdGroup
                {
                    Administrator = "Admin",
                }
            };

            var azureAdConfig = new AzureAdConfiguration()
            {
                ClientId     = "TestClientId",
                ClientSecret = "TestSecret",
                Authority    = "https://Test/Authority",
            };
            var tokenProvider = new Mock <ITokenProvider>();

            GraphApiSettings         = new GraphApiSettings(tokenProvider.Object, azureAdConfig);
            IdentityServiceApiClient = new Mock <IIdentityServiceApiClient>();

            AzureAdGraphUserResponse = new AzureAdGraphUserResponse()
            {
                ObjectId          = "1",
                DisplayName       = "T Tester",
                GivenName         = "Test",
                Surname           = "Tester",
                OtherMails        = new List <string>(),
                UserPrincipalName = "TestUser"
            };
            AzureAdGraphQueryResponse = new AzureAdGraphQueryResponse <AzureAdGraphUserResponse> {
                Value = new List <AzureAdGraphUserResponse> {
                    AzureAdGraphUserResponse
                }
            };

            var additionalData = new Dictionary <string, object>();

            var jobject = new JObject
            {
                new JProperty("@odata.type", "#microsoft.graph.group"),
                new JProperty("startDateTime", DateTime.UtcNow),
                new JProperty("endDateTime", DateTime.UtcNow.AddYears(1)),
                new JProperty("secretText", "The passwords must be 16-64 characters in length"),
                new JProperty("keyId", Guid.NewGuid().ToString()),
                new JProperty("hint", "something")
            };

            additionalData.Add("value", new List <JObject> {
                jobject
            });
            DirectoryObject = new DirectoryObject
            {
                Id             = "1",
                AdditionalData = additionalData,
                ODataType      = "@odata.type"
            };

            DistributedCache = new Mock <ICache>();

            Service = new UserApi.Services.UserAccountService(SecureHttpRequest.Object, GraphApiSettings, IdentityServiceApiClient.Object, _settings, DistributedCache.Object);
        }
 public GraphRepository(IOptions <GraphApiSettings> graphApiSettings)
 {
     this.graphApiSettings = graphApiSettings.Value;
 }