public AuthorizationHideForSessionFacet(IIdentifier identifier,
                                         IAuthorizationManager authorizationManager,
                                         ISpecification holder)
     : base(holder) {
     this.identifier = identifier;
     this.authorizationManager = authorizationManager;
 }
Beispiel #2
0
 public RequestExecutionValidator(IAuthenticationManager authenticationManager,
                                  IAuthorizationManager authorizationManager, ILogger <RequestExecutionValidator> logger)
 {
     _authenticationManager = authenticationManager;
     _authorizationManager  = authorizationManager;
     _logger = logger;
 }
Beispiel #3
0
        /// <summary>
        /// Configure the authorizaion manager.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="services"></param>
        /// <returns></returns>
        public static IServiceCollection UseAuthorizationManager <T>(this IServiceCollection services)
            where T : class, IAuthorizationManager
        {
            IAuthorizationManager authorizationManager = Activator.CreateInstance <T>();

            return(UseAuthorizationManager(services, authorizationManager));
        }
Beispiel #4
0
        public void TestSync( )
        {
            DBHelper.Init(Settings.Default.ConnectionString);
            DBHelper.ExecuteNonQuery("Test_DeleteAllData");

            IList <ADPrincipal> pl = GetPrincipalList( );

            ADSyncHelper.SyncAdToSqlServer(pl, Settings.Default.ConnectionString, "TestAD");

            IAuthorizationManager manager = Afcas.GetAuthorizationManager( );

            using (new ObjectCacheScope( )) {
                Assert.AreEqual(5, manager.GetPrincipalList( ).Count);

                //removal from sql side should not matter
                manager.RemovePrincipal("p1");
                ADSyncHelper.SyncAdToSqlServer(pl, Settings.Default.ConnectionString, "TestAD");
                Assert.AreEqual(5, manager.GetPrincipalList( ).Count);
            }

            using (new ObjectCacheScope( )) {
                //removal from ad side
                ADPrincipal p1 = pl[0];
                pl.RemoveAt(0);
                ADSyncHelper.SyncAdToSqlServer(pl, Settings.Default.ConnectionString, "TestAD");

                IList <Principal> dbpl = manager.GetPrincipalList( );
                Assert.AreEqual(4, dbpl.Count);
                Assert.That(!IsInList(p1.Name, dbpl));

                Assert.That(!manager.IsMemberOf("g1", "p1"));
            }
        }
Beispiel #5
0
        public DashboardViewModel(IDIContainer container, IAuthorizationManager authManager, INavigationService navigationService, ILocationHelper locationHelper, ILog log)
        {
            _authManager       = authManager;
            _navigationService = navigationService;
            _locationHelper    = locationHelper;
            _log = log;

            Client.Me().ContinueWith(t => { Me = t.Result.Response; });
            Client.Vehicles().ContinueWith(t =>
            {
                foreach (var v in t?.Result?.Response?.Data)
                {
                    OnNext(v);
                }
            });

            _vehicleObservable = Client.WatchVehicles();
            _vehicleObservable.Subscribe(this);

            LogoutCommand = container.Resolve <IRelayCommand <object> >();

            LogoutCommand.ExecuteAction = async b =>
            {
                await authManager.Logout();

                _navigationService.Navigate(this, "Logout", null);
            };

            MapZoomLevel = 7;
        }
Beispiel #6
0
 public ProcessingEngine(
     IPluginsContainer<ICommandImplementation> commandRepository,
     IPluginsContainer<ICommandObserver> commandObservers,
     ILogProvider logProvider,
     IPersistenceTransaction persistenceTransaction,
     IAuthorizationManager authorizationManager,
     XmlUtility xmlUtility,
     IUserInfo userInfo,
     ISqlUtility sqlUtility,
     ILocalizer localizer)
 {
     _commandRepository = commandRepository;
     _commandObservers = commandObservers;
     _logger = logProvider.GetLogger("ProcessingEngine");
     _performanceLogger = logProvider.GetLogger("Performance");
     _requestLogger = logProvider.GetLogger("ProcessingEngine Request");
     _commandsLogger = logProvider.GetLogger("ProcessingEngine Commands");
     _commandsResultLogger = logProvider.GetLogger("ProcessingEngine CommandsResult");
     _persistenceTransaction = persistenceTransaction;
     _authorizationManager = authorizationManager;
     _xmlUtility = xmlUtility;
     _userInfo = userInfo;
     _sqlUtility = sqlUtility;
     _localizer = localizer;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LoginController" /> class.
 /// </summary>
 /// <param name="authenticService">The authentic service.</param>
 /// <param name="masterDataManager">The master data manager.</param>
 /// <param name="localDateTimeManager">The local date time manager.</param>
 /// <param name="authorizationManager">The authorization manager.</param>
 public LoginController(IAuthenticateManager authenticService, IMasterDataManager masterDataManager, ILocalDateTimeManager localDateTimeManager, IAuthorizationManager authorizationManager)
 {
     this.authenticationManager = authenticService;
     this.masterDataManager = masterDataManager;
     this.localDateTimeManager = localDateTimeManager;
     this.authorizationManager = authorizationManager;
 }
        public override async Task OnAuthorizationAsync(HttpActionContext actionContext,
                                                        CancellationToken cancellationToken)
        {
            _authorizationManager = actionContext.Request.GetDependencyScope()
                                    .GetService(typeof(IAuthorizationManager)) as IAuthorizationManager;

            if (!actionContext.RequestContext.Principal.Identity.IsAuthenticated)
            {
                Forbidden(actionContext, cancellationToken);
            }

            var userId = actionContext.RequestContext.Principal.Identity.GetUserId <int>();

            if (userId == 0)
            {
                Forbidden(actionContext, cancellationToken);

                return;
            }

            if (!AccessByPermission(userId))
            {
                Forbidden(actionContext, cancellationToken);

                return;
            }

            await base.OnAuthorizationAsync(actionContext, cancellationToken);
        }
 public AccountController(IAuthorizationManager authorizationManager,
                          IHttpContextAccessor contextAccessor,
                          IAccountService accountService)
 {
     this.authorizationManager = authorizationManager ?? throw new ArgumentNullException(nameof(authorizationManager));
     this.contextAccessor      = contextAccessor ?? throw new ArgumentNullException(nameof(contextAccessor));
     this.accountService       = accountService ?? throw new ArgumentNullException(nameof(accountService));
 }
 public BackchannelAuthorizationService(IAuthorizationManager authorizationManager)
 {
     if (authorizationManager == null)
     {
         throw new ArgumentNullException(nameof(authorizationManager));
     }
     _authorizationManager = authorizationManager;
 }
 /// <summary>
 /// TokensController constructor
 /// </summary>
 /// <param name="userManager"></param>
 /// <param name="authorizationManager"></param>
 /// <param name="passwordHasher"></param>
 /// <param name="tokenConfiguration"></param>
 public TokensController(IUserManager userManager, IAuthorizationManager authorizationManager,
                         IPasswordHasher <UserProfile> passwordHasher, ITokenConfiguration tokenConfiguration)
 {
     _userManager          = userManager;
     _authorizationManager = authorizationManager;
     _passwordHasher       = passwordHasher;
     _tokenConfiguration   = tokenConfiguration;
 }
 public CouchPotatoService(IAuthorizationManager authorizationManager,IChatBot chatBot)
 {
     _couchpotatoApiKey = ConfigurationManager.AppSettings["couchpotato_apikey"];
     _couchpotatoUrl = ConfigurationManager.AppSettings["couchpotato_url"];
     _userAllowedMovieIds = new Dictionary<string, List<string>>();
     _authorizationManager = authorizationManager;
     _chatBot = chatBot;
 }
Beispiel #13
0
 public ActivityProgramController(
     IActivityProgramServices AapServices,
     IAuthorizationManager authorizationManager)
 {
     _AapServices           = AapServices;
     _viewModelMapperHelper = new ViewModelMapperHelper(_AapServices);
     _authorizationManager  = authorizationManager;
 }
        public GenericApplication(IUnitOfWork unitOfWork,
                                  IAuditTrailManager auditTrailManager,
                                  IAuthorizationManager authorizationManager)
        {
            UnitOfWork = unitOfWork;

            AuditTrailManager    = auditTrailManager;
            AuthorizationManager = authorizationManager;
        }
Beispiel #15
0
 public MessengerService()
 {
     _passwordHasher       = new PasswordHasher();
     _requestHelper        = new RequestHelper();
     _authorizationManager = new AuthorizationManager();
     _rsa     = new Rsa();
     _session = _requestHelper.GetCurrentSession();
     ImportRsaKey();
 }
Beispiel #16
0
 public ChatClient(IAuthorizationManager authorizationManager,
                   IUserManager userManager,
                   IMessageManager messageManager,
                   IRelationManager relationManager)
 {
     _authorizationManager = authorizationManager;
     _userManager          = userManager;
     _messageManager       = messageManager;
     _relationManager      = relationManager;
 }
Beispiel #17
0
 public static IAuthorizationManager GetAuthorizationManager( )
 {
     lock ( SyncRoot ) {
         if (_AuthManager == null)
         {
             _AuthManager = new AuthorizationManager( );
         }
         return(_AuthManager);
     }
 }
Beispiel #18
0
 private UserService Target(DatabaseContext context, IAuthorizationManager auth)
 {
     return(new UserService(
                userRepository: new UserRepository(context, AutomapperSingleton.Mapper),
                authorizationManager: auth,
                emailDomainValidatorService: new EmailDomainValidatorService("gmail.com|hipo.kz"),
                emailSender: new EmailSender(new SendGridClientFake()),
                viewRenderer: new ViewRendererFake(),
                baseUrls: new BaseUrls(_config)));
 }
Beispiel #19
0
        public UserEmail(
            IEmailSender emailSender, IViewRenderer viewRenderer, IAuthorizationManager authManager, IBaseUrls urls)
        {
            emailSender.ThrowIfNull(nameof(emailSender));
            viewRenderer.ThrowIfNull(nameof(viewRenderer));

            _emailSender  = emailSender;
            _viewRenderer = viewRenderer;
            _authManager  = authManager;
            _urls         = urls;
        }
        public ApiClient(IAuthorizationManager authMgr, IClientManager clientMgr)
        {
            _authMgr   = authMgr;
            _clientMgr = clientMgr;

            _client = new HttpClient
            {
                BaseAddress = new Uri(BASE_URI),
            };
            _client.DefaultRequestHeaders.Add(API_KEY_HEADER, API_KEY);
        }
Beispiel #21
0
        public ContactsController(IOperationContactsService operationContactsService,
                                  ICatalogService catalogService,
                                  IAuthorizationManager authorizationManager)
        {
            _operationContactsService = operationContactsService;
            _catalogService           = catalogService;
            _authorizationManager     = authorizationManager;

            _viewModelMapperHelper = new ViewModelMapperHelper(_operationContactsService,
                                                               _catalogService);
        }
Beispiel #22
0
 public EmailService(
     IEmailSender emailSender,
     IAuthorizationManager authManager,
     IViewRenderer viewRenderer,
     IBaseUrls url)
 {
     _emailSender = emailSender;
     _authManager = authManager;
     _view        = viewRenderer;
     _url         = url;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicAuthenticationBehavior"/> class.
        /// </summary>
        /// <param name="authorizationManager">The authorization manager.</param>
        public BasicAuthenticationBehavior(IAuthorizationManager authorizationManager)
        {
            if (authorizationManager == null)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError, Resources.Global.MissingAuthorizationManager);
            }

            m_authorizationManager = authorizationManager;

            RequiresSsl = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DigestAuthenticationBehavior"/> class.
        /// </summary>
        /// <param name="authorizationManager">The authorization manager.</param>
        public DigestAuthenticationBehavior(IAuthorizationManager authorizationManager)
        {
            if (authorizationManager == null)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError, Resources.Global.MissingAuthorizationManager);
            }

            NonceLifetime = TimeSpan.FromSeconds(DefaultNonceLifeTimeInSeconds);
            Qop = QualityOfProtection.Auth;

            m_authorizationManager = authorizationManager;
            m_encoder = new MD5Encoder();
            m_encryptor = new RijndaelEncryptor();
        }
Beispiel #25
0
 public ProcessingEngine(
     IPluginsContainer<ICommandImplementation> commandRepository,
     IPluginsContainer<ICommandObserver> commandObservers,
     ILogProvider logProvider,
     IPersistenceTransaction persistenceTransaction,
     IAuthorizationManager authorizationManager)
 {
     _commandRepository = commandRepository;
     _commandObservers = commandObservers;
     _logger = logProvider.GetLogger("ProcessingEngine");
     _performanceLogger = logProvider.GetLogger("Performance");
     _persistenceTransaction = persistenceTransaction;
     _authorizationManager = authorizationManager;
 }
        private void EnsureAuthZManager(HttpActionContext actionContext)
        {
            if (_authZType == null)
            {
                return;
            }

            if (_authZ == null)
            {
                var type = actionContext.ControllerContext.Configuration.DependencyResolver.GetService(_authZType) as IAuthorizationManager;
                if (type != null)
                {
                    _authZ = type;
                }
                else
                {
                    _authZ = Activator.CreateInstance(_authZType) as IAuthorizationManager;
                }
            }
        }
Beispiel #27
0
 public override void SetAuthorizationManager(IAuthorizationManager newAuthorizationManager) {
     throw new NotImplementedException();
 }
Beispiel #28
0
 public AuthenticationController(IAuthenticationManagement authenticationManagement, IAuthorizationManager authorizationManager)
 {
     _authenticationManagement = authenticationManagement;
     _authorizationManager = authorizationManager;
 }
 public AuthorizationService(IChatBot chatBot, IAuthorizationManager authorizationManager)
 {
     _chatBot = chatBot;
     _authorizationManager = authorizationManager;
 }
Beispiel #30
0
 public AuthorizationActionFilter(IAuthorizationManager authorizationManagement)
 {
     _authorizationManagement = authorizationManagement;
 }
 /// <summary>
 /// Constructs an instance of the KeyProvider_ZpaServer class.
 /// </summary>
 /// <param name="zpaFeatureFlags">The requested security options.</param>
 /// <param name="iAuthorizationManager">The password provider.</param>
 public KeyProvider_ZpaServer(ZpaFeatureFlags zpaFeatureFlags, IAuthorizationManager iAuthorizationManager)
 {
     this._zpaFeatureFlags = zpaFeatureFlags;
     this._iAuthorizationManager = iAuthorizationManager;
 }
 /// <summary>
 /// </summary>
 /// <param name="defaultAuthorizer">This will be used unless the object is recognised by one of the namespaceAuthorizers</param>
 public CustomAuthorizerInstaller(ITypeAuthorizer<object> defaultAuthorizer, params INamespaceAuthorizer[] namespaceAuthorizers) {
     authManager = new CustomAuthorizationManager(defaultAuthorizer, namespaceAuthorizers);
 }
 public SecurityFacetDecorator(IAuthorizationManager manager) {
     this.manager = manager;
 }
 public abstract void SetAuthorizationManager(IAuthorizationManager newAuthorizationManager);
        private static BasicAuthenticationBehavior CreateBehavior(IAuthorizationManager authorizationManager = null, bool isSecure = true)
        {
            BasicAuthenticationBehavior behavior = authorizationManager != null ?
                                                        new BasicAuthenticationBehavior(authorizationManager) :
                                                        new BasicAuthenticationBehavior();

            behavior.LoadBalancerSupport = isSecure; // simulates HTTPS protocol
            return behavior;
        }
 public override void SetAuthorizationManager(IAuthorizationManager newAuthorizationManager) {
     authorizationManager = newAuthorizationManager;
 }
 public CustomAuthorizerInstaller(ITypeAuthorizer<object> defaultAuthorizer) {
     authManager = new CustomAuthorizationManager(defaultAuthorizer);
 }
 public static void SetAuthorizationManager(this HttpConfiguration configuration, IAuthorizationManager manager)
 {
     configuration.Properties[ApiAuthorizeAttribute.PropertyName] = manager;
 }
        /// <summary>
        /// Sets basic authentication for the service proxy and authorizes users through the provided authorization manager
        /// instance.
        /// </summary>
        /// <param name="authorizationManager">The authorization manager.</param>
        /// <returns>The configuration object.</returns>
        public ProxyConfiguration RequireAuthorization(IAuthorizationManager authorizationManager)
        {
            if (authorizationManager == null)
            {
                throw new ArgumentNullException("authorizationManager");
            }

            Rest.Configuration.Options.ServiceProxyAuthorizationManager = authorizationManager;
            return this;
        }
 public AuthorizationBehavior(IAuthorizationManager authorizationManager)
 {
     this.authorizationManager = authorizationManager;
 }
 /// <summary>
 /// </summary>
 /// <param name="defaultAuthorizer">This will be used unless the object type exactly matches one of the typeauthorizers</param>
 /// <param name="typeAuthorizers">Each authorizer must implement ITypeAuthorizer for a concrete domain type</param>
 public CustomAuthorizerInstaller(ITypeAuthorizer<object> defaultAuthorizer, params object[] typeAuthorizers) {
     authManager = new CustomAuthorizationManager(defaultAuthorizer, typeAuthorizers);
 }