public OrganizationsController(
     IOrganizationRepository organizationRepository,
     IOrganizationUserRepository organizationUserRepository,
     IOrganizationConnectionRepository organizationConnectionRepository,
     ISelfHostedSyncSponsorshipsCommand syncSponsorshipsCommand,
     ICipherRepository cipherRepository,
     ICollectionRepository collectionRepository,
     IGroupRepository groupRepository,
     IPolicyRepository policyRepository,
     IPaymentService paymentService,
     ILicensingService licensingService,
     IApplicationCacheService applicationCacheService,
     GlobalSettings globalSettings,
     IReferenceEventService referenceEventService,
     IUserService userService)
 {
     _organizationRepository           = organizationRepository;
     _organizationUserRepository       = organizationUserRepository;
     _organizationConnectionRepository = organizationConnectionRepository;
     _syncSponsorshipsCommand          = syncSponsorshipsCommand;
     _cipherRepository        = cipherRepository;
     _collectionRepository    = collectionRepository;
     _groupRepository         = groupRepository;
     _policyRepository        = policyRepository;
     _paymentService          = paymentService;
     _licensingService        = licensingService;
     _applicationCacheService = applicationCacheService;
     _globalSettings          = globalSettings;
     _referenceEventService   = referenceEventService;
     _userService             = userService;
 }
Example #2
0
        public async Task Invoke(HttpContext httpContext, IScimContext scimContext, GlobalSettings globalSettings,
                                 IOrganizationRepository organizationRepository, IOrganizationConnectionRepository organizationConnectionRepository)
        {
            await scimContext.BuildAsync(httpContext, globalSettings, organizationRepository, organizationConnectionRepository);

            await _next.Invoke(httpContext);
        }
Example #3
0
 public SelfHostedSponsorshipSyncJob(
     IServiceProvider serviceProvider,
     IOrganizationRepository organizationRepository,
     IOrganizationConnectionRepository organizationConnectionRepository,
     ILicensingService licensingService,
     ILogger <SelfHostedSponsorshipSyncJob> logger,
     GlobalSettings globalSettings)
     : base(logger)
 {
     _serviceProvider                  = serviceProvider;
     _organizationRepository           = organizationRepository;
     _organizationConnectionRepository = organizationConnectionRepository;
     _licensingService                 = licensingService;
     _globalSettings = globalSettings;
 }
Example #4
0
        public async virtual Task BuildAsync(
            HttpContext httpContext,
            GlobalSettings globalSettings,
            IOrganizationRepository organizationRepository,
            IOrganizationConnectionRepository organizationConnectionRepository)
        {
            if (_builtHttpContext)
            {
                return;
            }

            _builtHttpContext = true;

            string orgIdString = null;

            if (httpContext.Request.RouteValues.TryGetValue("organizationId", out var orgIdObject))
            {
                orgIdString = orgIdObject?.ToString();
            }

            if (Guid.TryParse(orgIdString, out var orgId))
            {
                OrganizationId = orgId;
                Organization   = await organizationRepository.GetByIdAsync(orgId);

                if (Organization != null)
                {
                    var scimConnections = await organizationConnectionRepository.GetByOrganizationIdTypeAsync(Organization.Id,
                                                                                                              OrganizationConnectionType.Scim);

                    ScimConfiguration = scimConnections?.FirstOrDefault()?.GetConfig <ScimConfig>();
                }
            }

            if (RequestScimProvider == ScimProviderType.Default &&
                httpContext.Request.Headers.TryGetValue("User-Agent", out var userAgent))
            {
                if (userAgent.ToString().StartsWith("Okta"))
                {
                    RequestScimProvider = ScimProviderType.Okta;
                }
            }
            if (RequestScimProvider == ScimProviderType.Default &&
                httpContext.Request.Headers.ContainsKey("Adscimversion"))
            {
                RequestScimProvider = ScimProviderType.AzureAd;
            }
        }
 public OrganizationConnectionsController(
     ICreateOrganizationConnectionCommand createOrganizationConnectionCommand,
     IUpdateOrganizationConnectionCommand updateOrganizationConnectionCommand,
     IDeleteOrganizationConnectionCommand deleteOrganizationConnectionCommand,
     IOrganizationConnectionRepository organizationConnectionRepository,
     ICurrentContext currentContext,
     IGlobalSettings globalSettings,
     ILicensingService licensingService)
 {
     _createOrganizationConnectionCommand = createOrganizationConnectionCommand;
     _updateOrganizationConnectionCommand = updateOrganizationConnectionCommand;
     _deleteOrganizationConnectionCommand = deleteOrganizationConnectionCommand;
     _organizationConnectionRepository    = organizationConnectionRepository;
     _currentContext   = currentContext;
     _globalSettings   = globalSettings;
     _licensingService = licensingService;
 }
Example #6
0
 public SelfHostedSyncSponsorshipsCommand(
     IHttpClientFactory httpFactory,
     IOrganizationSponsorshipRepository organizationSponsorshipRepository,
     IOrganizationUserRepository organizationUserRepository,
     IOrganizationConnectionRepository organizationConnectionRepository,
     IGlobalSettings globalSettings,
     ILogger <SelfHostedSyncSponsorshipsCommand> logger)
     : base(
         httpFactory,
         globalSettings.Installation.ApiUri,
         globalSettings.Installation.IdentityUri,
         "api.installation",
         $"installation.{globalSettings.Installation.Id}",
         globalSettings.Installation.Key,
         logger)
 {
     _globalSettings                    = globalSettings;
     _organizationUserRepository        = organizationUserRepository;
     _organizationSponsorshipRepository = organizationSponsorshipRepository;
     _organizationConnectionRepository  = organizationConnectionRepository;
 }
 public CreateOrganizationConnectionCommand(IOrganizationConnectionRepository organizationConnectionRepository)
 {
     _organizationConnectionRepository = organizationConnectionRepository;
 }