/// <summary>
 /// Initializes a new instance of the <see cref="PushController"/> class.
 /// </summary>
 public PushController(
     IEventsService eventsService,
     ISubscriptionService subscriptionService,
     IPDP pdp,
     IOptions <PlatformSettings> platformSettings,
     IMemoryCache memoryCache)
 {
     _eventsService       = eventsService;
     _subscriptionService = subscriptionService;
     _authorizationHelper = new AuthorizationHelper(pdp);
     _platformSettings    = platformSettings.Value;
     _memoryCache         = memoryCache;
     _orgSubscriptioncacheEntryOptions = new MemoryCacheEntryOptions()
                                         .SetPriority(CacheItemPriority.High)
                                         .SetAbsoluteExpiration(
         new TimeSpan(0, 0, _platformSettings.SubscriptionCachingLifetimeInSeconds));
     _partySubscriptioncacheEntryOptions = new MemoryCacheEntryOptions()
                                           .SetPriority(CacheItemPriority.Normal)
                                           .SetAbsoluteExpiration(
         new TimeSpan(0, 0, _platformSettings.SubscriptionCachingLifetimeInSeconds));
     _orgAuthorizationEntryOptions = new MemoryCacheEntryOptions()
                                     .SetPriority(CacheItemPriority.High)
                                     .SetAbsoluteExpiration(
         new TimeSpan(0, 0, _platformSettings.SubscriptionCachingLifetimeInSeconds));
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstancesController"/> class
 /// </summary>
 public InstancesController(
     ILogger <InstancesController> logger,
     IRegister registerService,
     IInstance instanceService,
     IData dataService,
     IAppResources appResourcesService,
     IAltinnApp altinnApp,
     IProcess processService,
     IPDP pdp,
     IEvents eventsService,
     IOptions <AppSettings> appSettings,
     IPrefill prefillService)
 {
     _logger              = logger;
     _instanceService     = instanceService;
     _dataService         = dataService;
     _appResourcesService = appResourcesService;
     _registerService     = registerService;
     _altinnApp           = altinnApp;
     _processService      = processService;
     _pdp            = pdp;
     _eventsService  = eventsService;
     _appSettings    = appSettings.Value;
     _prefillService = prefillService;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppAccessHandler"/> class.
 /// </summary>
 /// <param name="httpContextAccessor">The http context accessor</param>
 /// <param name="pdp">The pdp</param>
 /// <param name="logger">The logger. </param>
 public AppAccessHandler(
     IHttpContextAccessor httpContextAccessor,
     IPDP pdp,
     ILogger <AppAccessHandler> logger)
 {
     _httpContextAccessor = httpContextAccessor;
     _pdp    = pdp;
     _logger = logger;
 }
        public AuthorizeInstancesHelperTest()
        {
            _pdp = new PepWithPDPAuthorizationMockSI(_instanceRepository.Object, Options.Create(new PepSettings
            {
                DisablePEP = false
            }));

            _authzHelper = new AuthorizationHelper(_pdp, Mock.Of <ILogger <AuthorizationHelper> >());
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppAccessHandler"/> class.
 /// </summary>
 /// <param name="httpContextAccessor">The http context accessor</param>
 /// <param name="pdp">The pdp</param>
 /// <param name="pepSettings">The settings for pep</param>
 public AppAccessHandler(
     IHttpContextAccessor httpContextAccessor,
     IPDP pdp,
     IOptions <PepSettings> pepSettings,
     ILogger <AppAccessHandler> logger)
 {
     _httpContextAccessor = httpContextAccessor;
     _pdp         = pdp;
     _pepSettings = pepSettings.Value;
     _logger      = logger;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PushController"/> class.
 /// </summary>
 public PushController(
     IEventsService eventsService,
     ISubscriptionService subscriptionService,
     IPDP pdp,
     IOptions <PlatformSettings> platformSettings)
 {
     _eventsService       = eventsService;
     _subscriptionService = subscriptionService;
     _authorizationHelper = new AuthorizationHelper(pdp);
     _platformSettings    = platformSettings.Value;
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageBoxInstancesController"/> class
 /// </summary>
 /// <param name="instanceRepository">the instance repository handler</param>
 /// <param name="instanceEventRepository">the instance event repository service</param>
 /// <param name="textRepository">the text repository handler</param>
 /// <param name="pdp">the policy decision point</param>
 /// <param name="logger">The logger to be used to perform logging from the controller.</param>
 public MessageBoxInstancesController(
     IInstanceRepository instanceRepository,
     IInstanceEventRepository instanceEventRepository,
     ITextRepository textRepository,
     IPDP pdp,
     ILogger <AuthorizationHelper> logger)
 {
     _instanceRepository      = instanceRepository;
     _instanceEventRepository = instanceEventRepository;
     _textRepository          = textRepository;
     _authorizationHelper     = new AuthorizationHelper(pdp, logger);
 }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProcessController"/> class
 /// </summary>
 /// <param name="instanceRepository">the instance repository handler</param>
 /// <param name="instanceEventRepository">the instance event repository service</param>
 /// <param name="pdp">the policy decision point.</param>
 /// <param name="generalsettings">the general settings</param>
 /// <param name="authzLogger">logger for authorization helper</param>
 public ProcessController(
     IInstanceRepository instanceRepository,
     IInstanceEventRepository instanceEventRepository,
     IPDP pdp,
     IOptions <GeneralSettings> generalsettings,
     ILogger <AuthorizationHelper> authzLogger)
 {
     _instanceRepository      = instanceRepository;
     _instanceEventRepository = instanceEventRepository;
     _storageBaseAndHost      = $"{generalsettings.Value.Hostname}/storage/api/v1/";
     _authorizationHelper     = new AuthorizationHelper(pdp, authzLogger);
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstancesController"/> class
 /// </summary>
 /// <param name="instanceRepository">the instance repository handler</param>
 /// <param name="instanceEventRepository">the instance event repository service</param>
 /// <param name="applicationRepository">the application repository handler</param>
 /// <param name="logger">the logger</param>
 /// <param name="pdp">the policy decision point.</param>
 public InstancesController(
     IInstanceRepository instanceRepository,
     IInstanceEventRepository instanceEventRepository,
     IApplicationRepository applicationRepository,
     ILogger <InstancesController> logger,
     IPDP pdp)
 {
     _instanceRepository      = instanceRepository;
     _instanceEventRepository = instanceEventRepository;
     _applicationRepository   = applicationRepository;
     _pdp    = pdp;
     _logger = logger;
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventsController"/> class
 /// </summary>
 public EventsController(
     IEventsService eventsService,
     IRegisterService registerService,
     IOptions <GeneralSettings> settings,
     ILogger <EventsController> logger,
     IPDP pdp,
     IOptions <AccessTokenSettings> accessTokenSettings)
 {
     _registerService     = registerService;
     _logger              = logger;
     _eventsService       = eventsService;
     _eventsBaseUri       = $"https://platform.{settings.Value.Hostname}";
     _authorizationHelper = new AuthorizationHelper(pdp);
     _accessTokenSettings = accessTokenSettings.Value;
 }
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstancesController"/> class
 /// </summary>
 /// <param name="instanceRepository">the instance repository handler</param>
 /// <param name="instanceEventRepository">the instance event repository service</param>
 /// <param name="applicationRepository">the application repository handler</param>
 /// <param name="logger">the logger</param>
 /// <param name="pdp">the policy decision point.</param>
 /// <param name="settings">the general settings.</param>
 public InstancesController(
     IInstanceRepository instanceRepository,
     IInstanceEventRepository instanceEventRepository,
     IApplicationRepository applicationRepository,
     ILogger <InstancesController> logger,
     IPDP pdp,
     IOptions <GeneralSettings> settings)
 {
     _instanceRepository      = instanceRepository;
     _instanceEventRepository = instanceEventRepository;
     _applicationRepository   = applicationRepository;
     _pdp                = pdp;
     _logger             = logger;
     _storageBaseAndHost = $"{settings.Value.Hostname}/storage/api/v1/";
 }
 /// <summary>
 /// The stateless data controller is responsible for creating and updating stateles data elements.
 /// </summary>
 public StatelessDataController(
     ILogger <DataController> logger,
     IAltinnApp altinnApp,
     IAppResources appResourcesService,
     IPrefill prefillService,
     IRegister registerService,
     IPDP pdp)
 {
     _logger              = logger;
     _altinnApp           = altinnApp;
     _appResourcesService = appResourcesService;
     _prefillService      = prefillService;
     _registerService     = registerService;
     _pdp = pdp;
 }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StorageAccessHandler"/> class.
 /// </summary>
 /// <param name="httpContextAccessor">The http context accessor</param>
 /// <param name="pdp">The pdp</param>
 /// <param name="pepSettings">The settings for pep</param>
 /// <param name="logger">The logger. </param>
 /// <param name="instanceRepository">The instance repository</param>
 /// <param name="memoryCache">The memory cache</param>
 public StorageAccessHandler(
     IHttpContextAccessor httpContextAccessor,
     IPDP pdp,
     IOptions <PepSettings> pepSettings,
     ILogger <StorageAccessHandler> logger,
     IInstanceRepository instanceRepository,
     IMemoryCache memoryCache)
 {
     _httpContextAccessor = httpContextAccessor;
     _pdp                = pdp;
     _logger             = logger;
     _pepSettings        = pepSettings.Value;
     _instanceRepository = instanceRepository;
     _memoryCache        = memoryCache;
 }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessController"/>
        /// </summary>
        public ProcessController(
            ILogger <ProcessController> logger,
            IInstance instanceService,
            IProcess processService,
            IAltinnApp altinnApp,
            IValidation validationService,
            IPDP pdp)
        {
            _logger            = logger;
            _instanceService   = instanceService;
            _processService    = processService;
            _altinnApp         = altinnApp;
            _validationService = validationService;
            _pdp = pdp;

            using Stream bpmnStream = _processService.GetProcessDefinition();
            processHelper           = new ProcessHelper(bpmnStream);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InstancesController"/> class
        /// </summary>
        public InstancesController(
            ILogger <InstancesController> logger,
            IRegister registerService,
            IInstance instanceService,
            IData dataService,
            IAppResources appResourcesService,
            IAltinnApp altinnApp,
            IProcess processService,
            IPDP pdp)
        {
            _logger              = logger;
            _instanceService     = instanceService;
            _dataService         = dataService;
            _appResourcesService = appResourcesService;
            _registerService     = registerService;
            _altinnApp           = altinnApp;
            _processService      = processService;

            _pdp = pdp;
        }
Esempio n. 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessController"/>
        /// </summary>
        public ProcessController(
            ILogger <ProcessController> logger,
            IInstance instanceService,
            IProcess processService,
            IProfile profileService,
            IRegister registerService,
            IOptions <GeneralSettings> generalSettings,
            IAltinnApp altinnApp,
            IValidation validationService,
            IPDP pdp)
        {
            _logger            = logger;
            _instanceService   = instanceService;
            _processService    = processService;
            _altinnApp         = altinnApp;
            _validationService = validationService;
            _pdp = pdp;

            userHelper = new UserHelper(profileService, registerService, generalSettings);
        }
Esempio n. 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstancesController"/> class
 /// </summary>
 /// <param name="instanceRepository">the instance repository handler</param>
 /// <param name="instanceEventRepository">the instance event repository service</param>
 /// <param name="applicationRepository">the application repository handler</param>
 /// <param name="partiesWithInstancesClient">An implementation of <see cref="IPartiesWithInstancesClient"/> that can be used to send information to SBL.</param>
 /// <param name="logger">the logger</param>
 /// <param name="authzLogger">the logger for the authorization helper</param>
 /// <param name="pdp">the policy decision point.</param>
 /// <param name="settings">the general settings.</param>
 public InstancesController(
     IInstanceRepository instanceRepository,
     IInstanceEventRepository instanceEventRepository,
     IApplicationRepository applicationRepository,
     IPartiesWithInstancesClient partiesWithInstancesClient,
     ILogger <InstancesController> logger,
     ILogger <AuthorizationHelper> authzLogger,
     IPDP pdp,
     IOptions <GeneralSettings> settings)
 {
     _instanceRepository         = instanceRepository;
     _instanceEventRepository    = instanceEventRepository;
     _applicationRepository      = applicationRepository;
     _partiesWithInstancesClient = partiesWithInstancesClient;
     _pdp                = pdp;
     _logger             = logger;
     _storageBaseAndHost = $"{settings.Value.Hostname}/storage/api/v1/";
     _authzHelper        = new AuthorizationHelper(pdp, authzLogger);
     _generalSettings    = settings.Value;
 }
Esempio n. 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessController"/>
        /// </summary>
        public ProcessController(
            ILogger <ProcessController> logger,
            IInstance instanceService,
            IProcess processService,
            IAltinnApp altinnApp,
            IValidation validationService,
            IPDP pdp,
            IEvents eventsService,
            IOptions <AppSettings> appSettings)
        {
            _logger            = logger;
            _instanceService   = instanceService;
            _processService    = processService;
            _altinnApp         = altinnApp;
            _validationService = validationService;
            _pdp           = pdp;
            _eventsService = eventsService;
            _appSettings   = appSettings.Value;

            using Stream bpmnStream = _processService.GetProcessDefinition();
            processHelper           = new ProcessHelper(bpmnStream);
        }
Esempio n. 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InstancesController"/> class
        /// </summary>
        public InstancesController(
            ILogger <InstancesController> logger,
            IRegister registerService,
            IInstance instanceService,
            IData dataService,
            IAppResources appResourcesService,
            IAltinnApp altinnApp,
            IProcess processService,
            IPDP pdp,
            IProfile profileService,
            IOptions <GeneralSettings> generalSettings)
        {
            _logger              = logger;
            _instanceService     = instanceService;
            _dataService         = dataService;
            _appResourcesService = appResourcesService;
            _registerService     = registerService;
            _altinnApp           = altinnApp;
            _processService      = processService;

            _pdp = pdp;

            _userHelper = new UserHelper(profileService, registerService, generalSettings);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizationHelper"/> class.
 /// </summary>
 /// <param name="pdp">The policy decision point</param>
 /// <param name="logger">The logger to use by the class.</param>
 public AuthorizationHelper(IPDP pdp, ILogger <AuthorizationHelper> logger)
 {
     _pdp    = pdp;
     _logger = logger;
 }
Esempio n. 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizationHelper"/> class.
 /// </summary>
 /// <param name="pdp">The policy decision point</param>
 public AuthorizationHelper(IPDP pdp)
 {
     _pdp = pdp;
 }
Esempio n. 22
0
        public AuthorizeInstancesHelperTest()
        {
            _pdp = new PepWithPDPAuthorizationMockSI(_instanceRepository.Object);

            _authzHelper = new AuthorizationHelper(_pdp, Mock.Of <ILogger <AuthorizationHelper> >());
        }