/// <summary>
 /// Constructor
 /// </summary>
 public GraphAppSharePointService(
     IGraphAuthProvider authProvider,
     IUserContext userContext,
     TimeTrackerOptions timeTrackerOptions) : base(authProvider, userContext)
 {
     _timeTrackerOptions = timeTrackerOptions ?? throw new ArgumentNullException(nameof(timeTrackerOptions));
 }
Esempio n. 2
0
        //private readonly IHttpContextAccessor httpContextAccessor;

        public GraphService(MemoryCache memoryCache, IGraphSdkHelper graphSdkHelper, IGraphAuthProvider authProvider)
        {
            this.memoryCache        = memoryCache;
            this.graphClientForUser = graphSdkHelper.GetAuthenticatedClientForUser();
            //this.graphClientForApplication = graphSdkHelper.GetAuthenticatedClientForApplication();
            this.authProvider = authProvider;
            //this.httpContextAccessor = httpContextAccessor;
        }
 public TeamHoursService(
     IGraphAuthProvider authProvider, GraphAppSharePointService graphAppSharePointService,
     IUserContext userContext,
     TimeTrackerOptions timeTrackerOptions, TeamHoursRepository teamHoursRepository) : base(authProvider, userContext)
 {
     _timeTrackerOptions  = timeTrackerOptions ?? throw new ArgumentNullException(nameof(timeTrackerOptions));
     _teamHoursRepository = teamHoursRepository ?? throw new ArgumentNullException(nameof(teamHoursRepository));
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="logger">The logging provider to use</param>
 /// <param name="timeTrackerOptions">The app settings provider</param>
 public MonthlyReportHoursService(IGraphAuthProvider authProvider,
                                  IUserContext userContext,
                                  TimeTrackerOptions timeTrackerOptions,
                                  ReportHoursRepository reportHoursRepository)
 {
     _timeTrackerOptions    = timeTrackerOptions ?? throw new ArgumentNullException(nameof(timeTrackerOptions));
     _reportHoursRepository = reportHoursRepository ?? throw new ArgumentNullException(nameof(reportHoursRepository)); // For HR
     //_notificationsRepository = notificationRepository ?? throw new ArgumentNullException(nameof(notificationRepository));
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public GraphTasksService(
     IGraphAuthProvider authProvider,
     IUserContext userContext,
     ILogger <GraphTasksService> logger,
     IOptionsSnapshot <TimeTrackerOptions> timeTrackerOptions) : base(authProvider, userContext)
 {
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     _timeTrackerOptions = timeTrackerOptions.Value ?? throw new ArgumentNullException(nameof(timeTrackerOptions));
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public GraphAppUserService(
     IGraphAuthProvider authProvider,
     IUserContext userContext,
     ILogger <GraphAppUserService> logger,
     IOptions <TimeTrackerOptions> timeTrackerOptions,
     IHostingEnvironment hostingEnvironment) : base(authProvider, userContext)
 {
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     _timeTrackerOptions = timeTrackerOptions.Value ?? throw new ArgumentNullException(nameof(timeTrackerOptions));
     _hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
 }
Esempio n. 7
0
 /// <summary>
 /// Constructor
 /// </summary>
 public GraphAppTasksService(
     IGraphAuthProvider authProvider,
     IUserContext userContext,
     // ILogger<GraphAppTasksService> logger,
     TimeTrackerOptions timeTrackerOptions,
     string userObjectIdentifier) : base(authProvider, userContext)
 {
     // _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _timeTrackerOptions   = timeTrackerOptions ?? throw new ArgumentNullException(nameof(timeTrackerOptions));
     _userObjectIdentifier = userObjectIdentifier;
 }
Esempio n. 8
0
        public SetupController(
            ILogger <SetupController> logger,
            IOptions <AppOptions> appOptions,
            ISetupService setupService,
            IGraphAuthProvider graphAuthProvider) : base(logger, appOptions)
        {
            Guard.Against.Null(setupService, "SetupController_Constructor" + nameof(setupService));
            Guard.Against.Null(graphAuthProvider, "SetupController_Constructor" + nameof(graphAuthProvider));

            _setupService      = setupService;
            _graphAuthProvider = graphAuthProvider;
        }
        public GraphBaseService(
            ILogger <T> logger,
            IOptions <AppOptions> appOptions,
            IGraphAuthProvider authProvider,
            IUserContext userContext,
            IGraphClientContext graphClientContext) : base(logger, appOptions)
        {
            Guard.Against.Null(authProvider, nameof(authProvider));
            Guard.Against.Null(userContext, nameof(userContext));
            Guard.Against.Null(graphClientContext, nameof(graphClientContext));
            _authProvider = authProvider;
            _userContext  = userContext;

            // Set current context to User by default (always default to least privilege)
            _currentClientContext = GraphClientContext.User;
        }
        public GraphClientAppContext(
            IGraphAuthProvider authProvider,
            IUserContext userContext)
        {
            _authProvider = authProvider ?? throw new ArgumentNullException(nameof(authProvider));
            _userContext  = userContext ?? throw new ArgumentNullException(nameof(userContext));

            // Initialize the graph client given the chosen context
            if (_graphServiceClient == null)
            {
                _graphServiceClient = new GraphServiceClient(new DelegateAuthenticationProvider(
                                                                 async requestMessage =>
                {
                    // Passing tenant ID to the auth provider to use as a cache key
                    var accessToken = await _authProvider.GetAppAccessTokenAsync();

                    // Append the access token to the request
                    requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
                }));
            }
        }
Esempio n. 11
0
        public DefaultBuildMonitorModelHandler(
            IConfiguration configuration,
            IGraphAuthProvider graphAuthProvider,
            IHttpContextAccessor httpContextAccessor,
            IMemoryCache memoryCache,
            ILogger logger,
            RequestHelper requestHelper)
        {
            _graphAuthProvider   = graphAuthProvider;
            _httpContextAccessor = httpContextAccessor;
            _cache         = memoryCache;
            _logger        = logger;
            _requestHelper = requestHelper;

            TeamCityUrl      = configuration["TeamCity:api_url"];
            ProjectsUrl      = TeamCityUrl + configuration["TeamCity:api_projects"];
            BuildTypesUrl    = TeamCityUrl + configuration["TeamCity:api_buildtypes"];
            RunningBuildsUrl = TeamCityUrl + configuration["TeamCity:api_runningbuilds"];
            BuildStatusUrl   = TeamCityUrl + configuration["TeamCity:api_buildstatus"];
            BuildQueueUrl    = TeamCityUrl + configuration["TeamCity:api_buildqueue"];

            InitializeSettings();
        }
        public GraphClientOnBehalfContext(
            IGraphAuthProvider authProvider,
            IUserContext userContext)
        {
            Guard.Against.Null(authProvider, nameof(authProvider));
            Guard.Against.Null(userContext, nameof(userContext));
            _authProvider = authProvider;
            _userContext  = userContext;

            // Initialize the graph client given the chosen context
            if (_graphServiceClient == null)
            {
                _graphServiceClient = new GraphServiceClient(new DelegateAuthenticationProvider(
                                                                 async requestMessage =>
                {
                    // Passing tenant ID to the auth provider to use as a cache key
                    var accessToken = await _authProvider.GetUserAccessTokenAsync(User.FindFirst(AzureAdConstants.ObjectIdClaimType)?.Value, true);

                    // Append the access token to the request
                    requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
                }));
            }
        }
Esempio n. 13
0
 public GraphServiceClientFactory(IGraphAuthProvider authProvider)
 {
     _authProvider = authProvider;
 }
Esempio n. 14
0
 public GraphServiceBase(IGraphAuthProvider authProvider, IUserContext userContext)
 {
     _authProvider = authProvider ?? throw new ArgumentNullException(nameof(authProvider));
     _userContext  = userContext ?? throw new ArgumentNullException(nameof(userContext));
 }
Esempio n. 15
0
 public GraphSdkHelper(IDaemonHelper daemonHelper, IGraphAuthProvider authProvider)
 {
     this.daemonHelper = daemonHelper;
     this.authProvider = authProvider;
 }
 public GraphController(IConfiguration configuration, IGraphSdkHelper graphSdkHelper, IGraphAuthProvider authProvider)
 {
     _configuration  = configuration;
     _graphSdkHelper = graphSdkHelper;
     _authProvider   = authProvider;
 }
Esempio n. 17
0
 public GraphSdkHelper(IGraphAuthProvider authProvider)
 {
     _authProvider = authProvider;
 }
Esempio n. 18
0
 public GraphSdkHelper(IGraphAuthProvider authProvider, IHttpContextAccessor httpContextAccessor, IMemoryCache memoryCache)
 {
     _authProvider        = authProvider;
     _httpContextAccessor = httpContextAccessor;
     _memoryCache         = memoryCache;
 }
 public ConfigureAzureOptions(IOptions <AzureAdOptions> azureOptions, IGraphAuthProvider authProvider)
 {
     _azureOptions = azureOptions.Value;
     _authProvider = authProvider;
 }
Esempio n. 20
0
 public GraphClientService(IGraphAuthProvider authProvider)
 {
     _authProvider = authProvider;
 }