public AuthorizationFilterTests()
 {
     ActionContext action = new ActionContext(Substitute.For<HttpContext>(), new RouteData(), new ActionDescriptor());
     context = new ResourceExecutingContext(action, new IFilterMetadata[0], new IValueProviderFactory[0]);
     authorization = Substitute.For<IAuthorizationProvider>();
     filter = new AuthorizationFilter(authorization);
 }
 protected AbstractController()
 {
     RepoBoard = RepositoryLocator.GetMemoryBoardRepository();
     RepoBoardList = RepositoryLocator.GetMemoryBoardListRepository();
     RepoCard = RepositoryLocator.GetMemoryCardRepository();
     RepoUser = RepositoryLocator.GetMemoryUserRepository();
     AuthorizationProvider = new MyTrelloAuthorizationProvider();
 }
        public MvcSiteMapProvider(IConfiguration config, IMvcSiteMapParser parser, IAuthorizationProvider authorization)
        {
            String path = Path.Combine(config["Application:Path"], config["SiteMap:Path"]);
            XElement siteMap = XElement.Load(path);
            Authorization = authorization;

            NodeTree = parser.GetNodeTree(siteMap);
            NodeList = ToList(NodeTree);
        }
Exemplo n.º 4
0
        public RoleServiceTests()
        {
            context = new TestingContext();
            authorizationProvider = Substitute.For<IAuthorizationProvider>();
            service = Substitute.ForPartsOf<RoleService>(new UnitOfWork(context), authorizationProvider);

            context.DropData();
            SetUpData();
        }
        public void SetUp()
        {
            ServiceLocatorInitializer.Init();
            controller = new MembershipController();

            mockedMembershipProvider = MockRepository.GenerateMock<IMembershipProvider>();
            mockedAuthenticationProvider = MockRepository.GenerateMock<IAuthenticationProvider>();
            mockedAuthorizationProvider = MockRepository.GenerateMock<IAuthorizationProvider>();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Values Controller
 /// </summary>
 public ValuesController(
     IAuthorizationProvider authorizationProvider, 
     IDataProvider dataProvider,
     IConfigurationProvider configurationProvider) : 
     base(authorizationProvider)
 {
     _dataProvider = dataProvider;
     _configurationProvider = configurationProvider;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthorizationProviderFactory"/> class. 
        /// Create a new instance of the <see cref="AuthorizationProviderFactory"/> class with the specified default <see cref="IAuthorizationProvider"/>
        /// </summary>
        /// <param name="defaultAuthorizationProvider">
        /// The <see cref="IAuthorizationProvider"/> based object
        /// </param>
        public AuthorizationProviderFactory(IAuthorizationProvider defaultAuthorizationProvider)
        {
            if (ConfigManager.Instance.Config.AuthorizationImplementation != null)
            {
                this._configuredType = ConfigManager.Instance.Config.AuthorizationImplementation.ImplementationType;
            }

            this._defaultAuthorizationProvider = defaultAuthorizationProvider;
        }
        public MvcSiteMapProviderTests()
        {
            parser = new MvcSiteMapParser();
            config = ConfigurationFactory.Create();
            context = HtmlHelperFactory.CreateHtmlHelper().ViewContext;
            authorizationProvider = Substitute.For<IAuthorizationProvider>();
            siteMap = new MvcSiteMapProvider(config, parser, authorizationProvider);

            route = context.RouteData.Values;
        }
        public AccountServiceTests()
        {
            context = new TestingContext();
            hasher = Substitute.For<IHasher>();
            authorizationProvider = Substitute.For<IAuthorizationProvider>();
            hasher.HashPassword(Arg.Any<String>()).Returns(info => info.Arg<String>() + "Hashed");

            context.DropData();
            SetUpData();

            service = new AccountService(new UnitOfWork(context), hasher, authorizationProvider);
            service.CurrentAccountId = account.Id;
        }
        internal void Init()
        {


            //NamedElementCollection<FwkAuthorizationRule> rules = FwkMembership.GetRules(Membership.Provider.Name);
            //IDictionary<string, IAuthorizationRule> authorizationRules = CreateRulesDictionary(rules);

            Fwk.Security.FwkAuthorizationRuleProvider wFwkAuthorizationRuleProvider = new Fwk.Security.FwkAuthorizationRuleProvider(Membership.Provider.Name);

            ruleProvider = wFwkAuthorizationRuleProvider;

            //Estas reglas podrian venir de un servicio
            rulesComboBox.DataSource = wFwkAuthorizationRuleProvider.GetAuthorizationRules();// FwkMembership.GetRulesList(frmAdmin.Provider.ApplicationName);

        }
Exemplo n.º 11
0
        public AuthorizationManager(
            IPluginsContainer<IClaimProvider> claimProviders,
            IUserInfo userInfo,
            ILogProvider logProvider,
            IAuthorizationProvider authorizationProvider)
        {
            _userInfo = userInfo;
            _claimProviders = claimProviders;
            _authorizationProvider = authorizationProvider;

            _logger = logProvider.GetLogger("AuthorizationManager");
            _performanceLogger = logProvider.GetLogger("Performance");

            _allowBuiltinAdminOverride = FromConfigAllowBuiltinAdminOverride();
        }
Exemplo n.º 12
0
 public AuthorizationManager(
     IPluginsContainer<IClaimProvider> claimProviders,
     IUserInfo userInfo,
     ILogProvider logProvider,
     IAuthorizationProvider authorizationProvider,
     IWindowsSecurity windowsSecurity,
     ILocalizer localizer)
 {
     _userInfo = userInfo;
     _claimProviders = claimProviders;
     _authorizationProvider = authorizationProvider;
     _windowsSecurity = windowsSecurity;
     _logger = logProvider.GetLogger(GetType().Name);
     _performanceLogger = logProvider.GetLogger("Performance");
     _allowBuiltinAdminOverride = FromConfigAllowBuiltinAdminOverride();
     _localizer = localizer;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataflowPrincipal"/> class. 
        /// Initialize a new instance of the <see cref="DataflowPrincipal"/> class with the specified <paramref name="identity"/> and <paramref name="authorizationProvider"/>
        /// </summary>
        /// <param name="identity">
        /// The <see cref="IIdentity"/> of this principal
        /// </param>
        /// <param name="authorizationProvider">
        /// The <see cref="IAuthorizationProvider"/> of this principal
        /// </param>
        /// <param name="user">
        /// The <see cref="IUser"/> for this principal
        /// </param>
        public DataflowPrincipal(IIdentity identity, IAuthorizationProvider authorizationProvider, IUser user)
        {
            if (identity == null)
            {
                throw new ArgumentNullException("identity");
            }

            if (authorizationProvider == null)
            {
                throw new ArgumentNullException("authorizationProvider");
            }

            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            this._user = user;
            this._identity = identity;
            this._authorizationProvider = authorizationProvider;
        }
 public RequiresAuthorizationAttribute(IAuthorizationProvider provider, IAccountRepository accountRepository, IUserRepository userRepository )
 {
     authorizationProvider = provider;
     this.accountRepository = accountRepository;
     this.userRepository = userRepository;
 }
Exemplo n.º 15
0
 public ContentController(IContentPathCache contentPathCache, IContentRepository contentRepository, IAuthorizationProvider authorizationProvider)
     : base(contentPathCache, contentRepository)
 {
     _authorizationProvider = authorizationProvider;
 }
 public CustomAuthorizeAttribute()
 {
     _provider = new MyTrelloAuthorizationProvider();
 }
Exemplo n.º 17
0
        public override void Initialize()
        {
            // inicializo Fwk Authorization provider y cathcing security provider
  
            this.ruleProvider  = ControlsFactory.CreateAuthorizationProvider(frmAdmin.Provider.Name);

            rulesComboBox.DataSource = FwkMembership.GetRules(frmAdmin.Provider.Name);

        }
Exemplo n.º 18
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Authorizer"/> class.
		/// </summary>
		/// <param name="authorizationProvider">The authorization provider.</param>
		public Authorizer(IAuthorizationProvider authorizationProvider)
		{
			this.AuthorizationProvider = authorizationProvider;
		}
Exemplo n.º 19
0
 public AuthorizationFilter(IAuthorizationProvider authorization)
 {
     Authorization = authorization;
 }
 public AuthorizeTagHelperTests()
 {
     output = new TagHelperOutput("authorize", new TagHelperAttributeList(), (useCachedResult, encoder) => null);
     helper = new AuthorizeTagHelper(authorizationProvider = Substitute.For<IAuthorizationProvider>());
     helper.ViewContext = HtmlHelperFactory.CreateHtmlHelper().ViewContext;
 }
 /// <summary>
 /// Initializes a new instance of <see cref="EnterpriseLibraryAuthorizationService"/>.
 /// </summary>
 public EnterpriseLibraryAuthorizationService()
 {
     _authorizationProvider = AuthorizationFactory.GetAuthorizationProvider();
 }
 /// <summary>
 /// Initializes a new instance of <see cref="EnterpriseLibraryAuthorizationService"/>.
 /// </summary>
 /// <param name="moduleName">The module name to get the authorization rules for.</param>
 public EnterpriseLibraryAuthorizationService(string moduleName)
 {
     _authorizationProvider = AuthorizationFactory.GetAuthorizationProvider(moduleName);
 }
Exemplo n.º 23
0
        public bool Start()
        {
            Startup();
            m_log.Info("[ASSETINVENTORY]: Starting AssetInventory Server");

            try
            {
                ConfigFile = AssetInventoryConfig.LoadConfig(ConfigFile);
            }
            catch (Exception)
            {
                m_log.Error("[ASSETINVENTORY]: Failed to load the config.");
                return false;
            }

            StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AssetStorageProvider",
                                                             "asset_storage_provider", false) as IAssetStorageProvider;
            m_backends.Add(StorageProvider);

            InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryStorageProvider",
                                                               "inventory_storage_provider", false) as IInventoryStorageProvider;
            m_backends.Add(InventoryProvider);

            MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider",
                                                             "metrics_provider", false) as IMetricsProvider;
            m_backends.Add(MetricsProvider);

            try
            {
                InitHttpServer((uint) ConfigFile.Configs["Config"].GetInt("listen_port"));
            }
            catch (Exception ex)
            {
                m_log.Error("[ASSETINVENTORY]: Initializing the HTTP server failed, shutting down: " + ex.Message);
                Shutdown();
                return false;
            }

            LoadDefaultAssets(); 

            AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider",
                                                                    "authentication_provider", false) as IAuthenticationProvider;
            m_backends.Add(AuthenticationProvider);

            AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider",
                                                                   "authorization_provider", false) as IAuthorizationProvider;
            m_backends.Add(AuthorizationProvider);

            m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", "frontends"));

            // Inform the user if we don't have any frontends at this point.
            if (m_frontends.Count == 0)
                m_log.Info("[ASSETINVENTORY]: Starting with no frontends loaded, which isn't extremely useful. Did you set the 'frontends' configuration parameter?");

            return true;
        }
Exemplo n.º 24
0
 public PresenceListener(Client client, IAuthorizationProvider provider)
 {
     _client = client;
     _provider = provider;
 }
Exemplo n.º 25
0
 public RoleService(IUnitOfWork unitOfWork, IAuthorizationProvider authorization)
     : base(unitOfWork)
 {
     Authorization = authorization;
 }
 /// <summary>
 /// Constructs a new <see cref="AuthorizationCallHandler"/> that checks using the given
 /// information.
 /// </summary>
 /// <param name="provider">Authorization provider.</param>
 /// <param name="operationName">Operation name to use to check authorization rules.</param>
 /// <param name="order">Order in which the handler will be executed.</param>
 public AuthorizationCallHandler(IAuthorizationProvider provider, string operationName, int order)
 {
     this.AuthorizationProvider = provider;
     this.OperationName = operationName;
     this.Order = order;
 }
Exemplo n.º 27
0
 public AuthorizeTagHelper(IAuthorizationProvider authorization)
 {
     Authorization = authorization;
 }
Exemplo n.º 28
0
 public BangumiClient(IOptions <BangumiOptions> bangumiOptionsAccesser, IAuthorizationProvider authorizationProvider, IAccessTokenStorage accessTokenStorage)
 {
     _bangumiOptionsAccesser = bangumiOptionsAccesser;
     _signInManager          = new SignInManager(bangumiOptionsAccesser, authorizationProvider, accessTokenStorage);
 }
 public MembershipController(IAuthenticationProvider authenticationProvider, IAuthorizationProvider authorizationProvider, IMembershipProvider membershipProvider)
 {
     this.authenticationProvider = authenticationProvider;
     this.authorizationProvider = authorizationProvider;
     this.membershipProvider = membershipProvider;
 }
Exemplo n.º 30
0
        public AuthorizationTask(IAuthorizationProvider provider)
	    {
            this.provider = provider;
	    }
 // Constructor
 public AuthorizationManager(IAuthorizationProvider <T> provider)
 {
     this.authorizationProvider = provider;
 }
Exemplo n.º 32
0
 /// <summary>
 /// Api Base Controller Controller
 /// </summary>
 public ApiBaseController(IAuthorizationProvider authorizationProvider)
 {
     _authorizationProvider = authorizationProvider;
 }
Exemplo n.º 33
0
 public Elections(IPublisher bus, IAuthorizationProvider authorizationProvider)
 {
     _bus = bus;
     _authorizationProvider = authorizationProvider ?? throw new ArgumentNullException(nameof(authorizationProvider));
 }