//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; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private MultiRealmAuthManager createAuthManager(boolean logSuccessfulAuthentications) throws Throwable private MultiRealmAuthManager CreateAuthManager(bool logSuccessfulAuthentications) { Log log = _logProvider.getLog(this.GetType()); InternalFlatFileRealm internalFlatFileRealm = new InternalFlatFileRealm(Users, new InMemoryRoleRepository(), mock(typeof(PasswordPolicy)), _authStrategy, mock(typeof(JobScheduler)), CommunitySecurityModule.getInitialUserRepository(Config, NullLogProvider.Instance, FsRule.get()), EnterpriseSecurityModule.GetDefaultAdminRepository(Config, NullLogProvider.Instance, FsRule.get())); _manager = new MultiRealmAuthManager(internalFlatFileRealm, Collections.singleton(internalFlatFileRealm), new MemoryConstrainedCacheManager(), new SecurityLog(log), logSuccessfulAuthentications, false, Collections.emptyMap()); _manager.init(); return(_manager); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void setupAuthManager(org.neo4j.server.security.auth.AuthenticationStrategy authStrategy) throws Throwable private void SetupAuthManager(AuthenticationStrategy authStrategy) { FormattedLog.Builder builder = FormattedLog.withUTCTimeZone(); _securityLogWriter = new StringWriter(); Log log = builder.ToWriter(_securityLogWriter); _securityLog = new SecurityLog(log); InternalFlatFileRealm internalFlatFileRealm = new InternalFlatFileRealm(_users, new InMemoryRoleRepository(), new BasicPasswordPolicy(), authStrategy, mock(typeof(JobScheduler)), new InMemoryUserRepository(), new InMemoryUserRepository() ); _manager = new MultiRealmAuthManager(internalFlatFileRealm, Collections.singleton(internalFlatFileRealm), new MemoryConstrainedCacheManager(), _securityLog, true, false, Collections.emptyMap()); _manager.init(); }
//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() { _testRealm = new TestRealm(thisnew InMemoryUserRepository(), new InMemoryRoleRepository(), new BasicPasswordPolicy(), NewRateLimitedAuthStrategy(), mock(typeof(JobScheduler)), new InMemoryUserRepository(), new InMemoryUserRepository() ); IList <Realm> realms = listOf(_testRealm); _authManager = new MultiRealmAuthManager(_testRealm, realms, new MemoryConstrainedCacheManager(), mock(typeof(SecurityLog)), true, false, Collections.emptyMap()); _authManager.init(); _authManager.start(); _authManager.UserManager.newUser("mike", password("123"), false); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotLogAuthenticationIfFlagSaysNo() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotLogAuthenticationIfFlagSaysNo() { // Given _manager.shutdown(); _manager = CreateAuthManager(false); Users.create(NewUser("jake", "abc123", false)); _manager.start(); SetMockAuthenticationStrategyResult("jake", "abc123", AuthenticationResult.SUCCESS); // When AuthenticationResult result = _manager.login(authToken("jake", "abc123")).subject().AuthenticationResult; // Then assertThat(result, equalTo(AuthenticationResult.SUCCESS)); _logProvider.assertNone(Info("[jake]: logged in")); }
//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() { SecurityLog securityLog = mock(typeof(SecurityLog)); InternalFlatFileRealm internalFlatFileRealm = new InternalFlatFileRealm(new InMemoryUserRepository(), new InMemoryRoleRepository(), new BasicPasswordPolicy(), new RateLimitedAuthenticationStrategy(Clock.systemUTC(), Config.defaults()), mock(typeof(JobScheduler)), new InMemoryUserRepository(), new InMemoryUserRepository() ); _testRealm = new TestRealm(this, LdapConfig, securityLog, new SecureHasher()); IList <Realm> realms = listOf(internalFlatFileRealm, _testRealm); _fakeTicker = new FakeTicker(); _authManager = new MultiRealmAuthManager(internalFlatFileRealm, realms, new ShiroCaffeineCache.Manager(_fakeTicker.read, 100, 10, true), securityLog, false, false, Collections.emptyMap()); _authManager.init(); _authManager.start(); _authManager.UserManager.newUser("mike", password("123"), false); _authManager.UserManager.newUser("mats", password("456"), false); }
internal StandardEnterpriseLoginContext(MultiRealmAuthManager authManager, ShiroSubject shiroSubject) { this._authManager = authManager; this._shiroSubject = shiroSubject; this._neoShiroSubject = new NeoShiroSubject(this); }