//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { TestGraphDatabaseFactory s = new TestEnterpriseGraphDatabaseFactory(); _db = ( GraphDatabaseFacade )s.NewImpermanentDatabaseBuilder(TestDirectory.storeDir()).setConfig(SecuritySettings.property_level_authorization_enabled, "true").setConfig(SecuritySettings.property_level_authorization_permissions, "Agent=alias,secret").setConfig(SecuritySettings.procedure_roles, "test.*:procRole").setConfig(GraphDatabaseSettings.auth_enabled, "true").newGraphDatabase(); EnterpriseAuthAndUserManager authManager = ( EnterpriseAuthAndUserManager )_db.DependencyResolver.resolveDependency(typeof(EnterpriseAuthManager)); Procedures procedures = _db.DependencyResolver.resolveDependency(typeof(Procedures)); procedures.RegisterProcedure(typeof(TestProcedure)); EnterpriseUserManager userManager = authManager.UserManager; userManager.NewUser("Neo", password("eon"), false); userManager.NewUser("Smith", password("mr"), false); userManager.NewUser("Jones", password("mr"), false); userManager.NewUser("Morpheus", password("dealwithit"), false); userManager.NewRole("procRole", "Jones"); userManager.NewRole("Agent", "Smith", "Jones"); userManager.AddRoleToUser(PredefinedRoles.ARCHITECT, "Neo"); userManager.AddRoleToUser(PredefinedRoles.READER, "Smith"); userManager.AddRoleToUser(PredefinedRoles.READER, "Morpheus"); _neo = authManager.Login(authToken("Neo", "eon")); _smith = authManager.Login(authToken("Smith", "mr")); _jones = authManager.Login(authToken("Jones", "mr")); _morpheus = authManager.Login(authToken("Morpheus", "dealwithit")); }
internal PersonalUserManager(EnterpriseUserManager userManager, AuthSubject subject, SecurityLog securityLog, bool isUserManager) { this._userManager = userManager; this._securityLog = securityLog; this._subject = subject; this._isUserManager = isUserManager; }
public virtual EnterpriseAuthAndUserManager NewAuthManager(Config config, LogProvider logProvider, SecurityLog securityLog, FileSystemAbstraction fileSystem, JobScheduler jobScheduler, AccessCapability accessCapability) { SecurityConfig = GetValidatedSecurityConfig(config); IList <Realm> realms = new List <Realm>(SecurityConfig.authProviders.Count + 1); SecureHasher secureHasher = new SecureHasher(); EnterpriseUserManager internalRealm = CreateInternalRealm(config, logProvider, fileSystem, jobScheduler, securityLog, accessCapability); if (internalRealm != null) { realms.Add(( Realm )internalRealm); } if (SecurityConfig.hasLdapProvider) { realms.Add(new LdapRealm(config, securityLog, secureHasher)); } if (SecurityConfig.pluginAuthProviders.Count > 0) { ((IList <Realm>)realms).AddRange(CreatePluginRealms(config, securityLog, secureHasher, SecurityConfig)); } // Select the active realms in the order they are configured IList <Realm> orderedActiveRealms = SelectOrderedActiveRealms(SecurityConfig.authProviders, realms); if (orderedActiveRealms.Count == 0) { throw IllegalConfiguration("No valid auth provider is active."); } return(new MultiRealmAuthManager(internalRealm, orderedActiveRealms, CreateCacheManager(config), securityLog, config.Get(SecuritySettings.security_log_successful_authentication), SecurityConfig.propertyAuthorization, SecurityConfig.propertyBlacklist)); }
protected internal virtual EnterpriseUserManager CreateInternalRealm(Config config, LogProvider logProvider, FileSystemAbstraction fileSystem, JobScheduler jobScheduler, SecurityLog securityLog, AccessCapability accessCapability) { EnterpriseUserManager internalRealm = null; if (SecurityConfig.hasNativeProvider) { internalRealm = CreateInternalFlatFileRealm(config, logProvider, fileSystem, jobScheduler); } return(internalRealm); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { Config = Config.defaults(); Users = CommunitySecurityModule.getUserRepository(Config, NullLogProvider.Instance, FsRule.get()); _authStrategy = mock(typeof(AuthenticationStrategy)); _logProvider = new AssertableLogProvider(); _manager = CreateAuthManager(true); _userManager = _manager.UserManager; }
internal MultiRealmAuthManager(EnterpriseUserManager userManager, ICollection <Realm> realms, CacheManager cacheManager, SecurityLog securityLog, bool logSuccessfulLogin, bool propertyAuthorization, IDictionary <string, IList <string> > roleToPropertyBlacklist) { this._userManager = userManager; this._realms = realms; this._cacheManager = cacheManager; _securityManager = new DefaultSecurityManager(realms); this._securityLog = securityLog; this._logSuccessfulLogin = logSuccessfulLogin; this._propertyAuthorization = propertyAuthorization; this._roleToPropertyBlacklist = roleToPropertyBlacklist; _securityManager.SubjectFactory = new ShiroSubjectFactory(); (( ModularRealmAuthenticator )_securityManager.Authenticator).AuthenticationStrategy = new ShiroAuthenticationStrategy(); _securityManager.SubjectDAO = CreateSubjectDAO(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { _log = new AssertableLogProvider(); SecurityLog securityLog = new SecurityLog(_log.getLog(this.GetType())); AuthProcedures = new TestUserManagementProcedures(); AuthProcedures.graph = mock(typeof(GraphDatabaseAPI)); AuthProcedures.securityLog = securityLog; _generalUserManager = UserManager; EnterpriseSecurityContext adminContext = new EnterpriseSecurityContext(new MockAuthSubject("admin"), [email protected]_Static.Full, Collections.emptySet(), true); _matsContext = new EnterpriseSecurityContext(new MockAuthSubject("mats"), [email protected]_Static.None, Collections.emptySet(), false); Subject = adminContext; _log.clear(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before @Override public void setup() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public override void Setup() { base.Setup(); LdapServerRule.LdapServer.ConfidentialityRequired = _confidentialityRequired; EnterpriseAuthAndUserManager authManager = DbRule.resolveDependency(typeof(EnterpriseAuthAndUserManager)); EnterpriseUserManager userManager = authManager.UserManager; if (userManager != null) { userManager.NewUser(NONE_USER, _password.GetBytes(), false); userManager.NewUser(PROC_USER, _password.GetBytes(), false); userManager.NewUser(READ_USER, _password.GetBytes(), false); userManager.NewUser(WRITE_USER, _password.GetBytes(), false); userManager.AddRoleToUser(PredefinedRoles.READER, READ_USER); userManager.AddRoleToUser(PredefinedRoles.PUBLISHER, WRITE_USER); userManager.NewRole("role1", PROC_USER); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void configuredSetup(java.util.Map<String,String> config) throws Throwable internal virtual void ConfiguredSetup(IDictionary <string, string> config) { Neo = setUpNeoServer(config); Procedures procedures = Neo.LocalGraph.DependencyResolver.resolveDependency(typeof(Procedures)); procedures.RegisterProcedure(typeof(ClassWithProcedures)); procedures.RegisterFunction(typeof(ClassWithFunctions)); UserManager = Neo.LocalUserManager; UserManager.newUser("noneSubject", password("abc"), false); UserManager.newUser("pwdSubject", password("abc"), true); UserManager.newUser("adminSubject", password("abc"), false); UserManager.newUser("schemaSubject", password("abc"), false); UserManager.newUser("writeSubject", password("abc"), false); UserManager.newUser("editorSubject", password("abc"), false); UserManager.newUser("readSubject", password("123"), false); // Currently admin role is created by default UserManager.addRoleToUser(ADMIN, "adminSubject"); UserManager.addRoleToUser(ARCHITECT, "schemaSubject"); UserManager.addRoleToUser(PUBLISHER, "writeSubject"); UserManager.addRoleToUser(EDITOR, "editorSubject"); UserManager.addRoleToUser(READER, "readSubject"); UserManager.newRole(_emptyRole); NoneSubject = Neo.login("noneSubject", "abc"); PwdSubject = Neo.login("pwdSubject", "abc"); ReadSubject = Neo.login("readSubject", "123"); EditorSubject = Neo.login("editorSubject", "abc"); WriteSubject = Neo.login("writeSubject", "abc"); SchemaSubject = Neo.login("schemaSubject", "abc"); AdminSubject = Neo.login("adminSubject", "abc"); using (Transaction tx = Neo.LocalGraph.beginTx(1, TimeUnit.HOURS)) { AssertEmpty(SchemaSubject, "CREATE (n) SET n:A:Test:NEWNODE:VeryUniqueLabel:Node " + "SET n.id = '2', n.square = '4', n.name = 'me', n.prop = 'a', n.number = '1' " + "DELETE n"); AssertEmpty(WriteSubject, "UNWIND range(0,2) AS number CREATE (:Node {number:number, name:'node'+number})"); tx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { AuthManagerRule.Manager.start(); _manager = AuthManagerRule.Manager.UserManager; _manager.newUser("mats", password("foo"), false); }
internal EvilUserManager(PersonalUserManagerTest outerInstance, EnterpriseUserManager @delegate) { this._outerInstance = outerInstance; this.Delegate = @delegate; }