public override void SetUp()
 {
     base.SetUp();
     _originalSettings = CloudConfigurationManager.AppSettings;
     _configRepository = ObjectFactory.GetInstance <IConfigRepository>();
     _securityServices = ObjectFactory.GetInstance <ISecurityServices>();
 }
 public AuthenticationController(ISecurityServices securityServices, ITerminal terminal, IAuthorization authorization, IPlanDirectoryService planDirectoryService)
 {
     _security             = securityServices;
     _terminal             = terminal;
     _authorization        = authorization;
     _planDirectoryService = planDirectoryService;
 }
Esempio n. 3
0
 public AuthenticationCallbackController()
 {
     _terminal      = ObjectFactory.GetInstance <ITerminal>();
     _activity      = ObjectFactory.GetInstance <IActivity>();
     _authorization = ObjectFactory.GetInstance <IAuthorization>();
     _security      = ObjectFactory.GetInstance <ISecurityServices>();
 }
Esempio n. 4
0
 public UsersController()
 {
     _fr8Account       = ObjectFactory.GetInstance <Fr8Account>();
     _securityServices = ObjectFactory.GetInstance <ISecurityServices>();
     _mappingEngine    = ObjectFactory.GetInstance <IMappingEngine>();
     _fr8Account       = ObjectFactory.GetInstance <Fr8Account>();
 }
        public IHttpActionResult Login([FromUri] string username, [FromUri] string password)
        {
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                Logger.GetLogger().Warn($"Username or password is not specified");
                return(BadRequest("Username or password is not specified"));
            }

            Request.GetOwinContext().Authentication.SignOut();

            using (IUnitOfWork uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                Fr8AccountDO dockyardAccountDO = uow.UserRepository.FindOne(x => x.UserName == username);
                if (dockyardAccountDO != null)
                {
                    var passwordHasher = new PasswordHasher();
                    if (passwordHasher.VerifyHashedPassword(dockyardAccountDO.PasswordHash, password) == PasswordVerificationResult.Success)
                    {
                        ISecurityServices security = ObjectFactory.GetInstance <ISecurityServices>();
                        ClaimsIdentity    identity = security.GetIdentity(uow, dockyardAccountDO);
                        Request.GetOwinContext().Authentication.SignIn(new AuthenticationProperties
                        {
                            IsPersistent = true
                        }, identity);

                        return(Ok());
                    }
                }
            }
            Logger.GetLogger().Warn($"Loging failed for {username}");
            return(StatusCode(HttpStatusCode.Forbidden));
        }
Esempio n. 6
0
 public Activity(ICrateManager crateManager, IAuthorization authorizationToken, ISecurityServices security, IActivityTemplate activityTemplate, IPlanNode planNode, IUpstreamDataExtractionService upstreamDataExtractionService)
 {
     _crateManager                  = crateManager;
     _authorizationToken            = authorizationToken;
     _security                      = security;
     _activityTemplate              = activityTemplate;
     _planNode                      = planNode;
     _upstreamDataExtractionService = upstreamDataExtractionService;
 }
Esempio n. 7
0
 public Plan(IContainerService containerService, Fr8Account dockyardAccount, IActivity activity,
             ICrateManager crate, ISecurityServices security, IJobDispatcher dispatcher, IPusherNotifier pusher)
 {
     _containerService = containerService;
     _dockyardAccount  = dockyardAccount;
     _activity         = activity;
     _crate            = crate;
     _security         = security;
     _dispatcher       = dispatcher;
     _pusherNotifier   = pusher;
 }
Esempio n. 8
0
        public Terminal(IConfigRepository configRepository, ISecurityServices securityServices)
        {
            _securityServices     = securityServices;
            IsATandTCacheDisabled = string.Equals(CloudConfigurationManager.GetSetting("DisableATandTCache"), "true", StringComparison.InvariantCultureIgnoreCase);

            var serverProtocol = configRepository.Get("ServerProtocol", String.Empty);
            var domainName     = configRepository.Get("ServerDomainName", String.Empty);
            var domainPort     = configRepository.Get <int?>("ServerPort", null);

            _serverUrl = $"{serverProtocol}{domainName}{(domainPort == null || domainPort.Value == 80 ? String.Empty : (":" + domainPort.Value))}/";
        }
Esempio n. 9
0
 public PlansController(IPlan plan,
                        ISecurityServices securityServices,
                        ICrateManager crateManager,
                        IPusherNotifier pusherNotifier,
                        IActivityTemplate activityTemplate,
                        IActivity activity,
                        IPlanDirectoryService planDirectoryService)
 {
     _plan                 = plan;
     _security             = securityServices;
     _crate                = crateManager;
     _pusherNotifier       = pusherNotifier;
     _activityTemplate     = activityTemplate;
     _activity             = activity;
     _planDirectoryService = planDirectoryService;
 }
        public ManifestRegistryController(
            IManifestRegistryMonitor manifestRegistryMonitor,
            IFr8Account fr8Account,
            IRestfulServiceClient restfulServiceClient,
            IUnitOfWorkFactory uowFactory,
            IPusherNotifier pusher,
            ISecurityServices securityServices)
        {
            if (manifestRegistryMonitor == null)
            {
                throw new ArgumentNullException(nameof(manifestRegistryMonitor));
            }

            _manifestRegistryMonitor = manifestRegistryMonitor;
            _fr8Account           = fr8Account;
            _restfulServiceClient = restfulServiceClient;
            _uowFactory           = uowFactory;
            _pusher           = pusher;
            _securityServices = securityServices;
        }
        public TerminalDiscoveryService(
            IActivityTemplate activityTemplateService,
            ITerminal terminal,
            IRestfulServiceClient restfulServiceClient,
            EventReporter eventReporter,
            IUnitOfWorkFactory unitOfWorkFactory,
            IConfigRepository configRepository,
            ISecurityServices securityService)
        {
            _activityTemplateService = activityTemplateService;
            _terminal             = terminal;
            _restfulServiceClient = restfulServiceClient;
            _eventReporter        = eventReporter;
            _unitOfWorkFactory    = unitOfWorkFactory;
            _securityService      = securityService;

            var serverProtocol = configRepository.Get("ServerProtocol", String.Empty);
            var domainName     = configRepository.Get("ServerDomainName", String.Empty);
            var domainPort     = configRepository.Get <int?>("ServerPort", null);

            _serverUrl = $"{serverProtocol}{domainName}{(domainPort == null || domainPort.Value == 80 ? String.Empty : (":" + domainPort.Value))}/";
        }
Esempio n. 12
0
        public bool IsCurrentUserInAdminRole()
        {
            ISecurityServices _security = ObjectFactory.GetInstance <ISecurityServices>();
            bool isAdmin = false;

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                //get the current account
                var curAccount = _security.GetCurrentAccount(uow);
                //get the roles to check if the account has admin role
                var curAccountRoles = curAccount.Roles;
                //get the role id
                var adminRoleId = uow.AspNetRolesRepository.GetQuery().Single(r => r.Name == Roles.Admin).Id;
                //provide all facts if the user has admin role
                if (curAccountRoles.Any(x => x.RoleId == adminRoleId))
                {
                    isAdmin = true;
                }
            }

            return(isAdmin);
        }
Esempio n. 13
0
 public ContainersController()
 {
     _containerService = ObjectFactory.GetInstance <IContainerService>();
     _security         = ObjectFactory.GetInstance <ISecurityServices>();
 }
Esempio n. 14
0
 public AuthorizeActivityInterceptor(ISecurityServices securityServices)
 {
     _securityServices = securityServices;
 }
 public IncidentReporter(EventReporter eventReporter, ITerminal terminal, ISecurityServices securityService)
 {
     _eventReporter = eventReporter;
     _terminal      = terminal;
     _sercurity     = securityService;
 }
Esempio n. 16
0
 public Report()
 {
     _security = ObjectFactory.GetInstance <ISecurityServices>();
 }
Esempio n. 17
0
 public PlanSecurityDecorator(IPlan target, ISecurityServices securityServices)
 {
     _securityServices = securityServices;
     _target           = target;
 }
Esempio n. 18
0
 public NotificationsController(IPusherNotifier pusherNotifier, ISecurityServices security) : base(security)
 {
     _pusherNotifier = pusherNotifier;
 }
 public TerminalServiceForTests(IConfigRepository configRepository, ISecurityServices securityServices)
 {
     _terminal = new Terminal(configRepository, securityServices);
 }
Esempio n. 20
0
 public Fr8BaseApiController(ISecurityServices security)
 {
     _security = security;
 }
Esempio n. 21
0
 public EventReporter(IActivityTemplate activityTemplate, ITerminal terminal)
 {
     _activityTemplate = activityTemplate;
     _terminal         = terminal;
     _security         = ObjectFactory.GetInstance <ISecurityServices>();
 }
Esempio n. 22
0
 public Fact(ISecurityServices security)
 {
     _securityServices = security;
 }
Esempio n. 23
0
 public Subplan()
 {
     _activity = ObjectFactory.GetInstance <IActivity>();
     _security = ObjectFactory.GetInstance <ISecurityServices>();
 }
Esempio n. 24
0
 public SecurityController(ISecurityServices securityServices, IAppServices appServices)
 {
     _securityServices = securityServices;
     _appServices      = appServices;
 }
 public SecurityController(ISecurityServices service) => this.service = service;
 public UserManagerController(ISecurityServices securityServices, IUserServices userServices)
 {
     _securityServices = securityServices;
     _userServices     = userServices;
 }
Esempio n. 27
0
 public PageDefinitionsController()
 {
     _pageDefinition           = ObjectFactory.GetInstance <IPageDefinition>();
     _securityServices         = ObjectFactory.GetInstance <ISecurityServices>();
     _webServicesPageGenerator = ObjectFactory.GetInstance <IWebservicesPageGenerator>();
 }
 public FilesController(IFile fileService)
 {
     _fileService = fileService;
     _security    = ObjectFactory.GetInstance <ISecurityServices>();
     _tagService  = ObjectFactory.GetInstance <ITag>();
 }
Esempio n. 29
0
 public ReportsController(IReport report, ISecurityServices securityService, IUnitOfWorkFactory uowFactory)
 {
     _report          = report;
     _securityService = securityService;
     _uowFactory      = uowFactory;
 }