use of org.sonar.api.security.LoginPasswordAuthenticator in project sonarqube by SonarSource.
the class SecurityRealmFactoryTest method should_provide_compatibility_for_authenticator.
@Test
public void should_provide_compatibility_for_authenticator() {
settings.setProperty(CoreProperties.CORE_AUTHENTICATOR_CLASS, FakeAuthenticator.class.getName());
LoginPasswordAuthenticator authenticator = new FakeAuthenticator();
SecurityRealmFactory factory = new SecurityRealmFactory(settings, new LoginPasswordAuthenticator[] { authenticator });
SecurityRealm realm = factory.getRealm();
assertThat(realm).isInstanceOf(CompatibilityRealm.class);
}
use of org.sonar.api.security.LoginPasswordAuthenticator in project sonarqube by SonarSource.
the class SecurityRealmFactoryTest method should_take_precedence_over_authenticator.
@Test
public void should_take_precedence_over_authenticator() {
SecurityRealm realm = new FakeRealm();
settings.setProperty(CoreProperties.CORE_AUTHENTICATOR_REALM, realm.getName());
LoginPasswordAuthenticator authenticator = new FakeAuthenticator();
settings.setProperty(CoreProperties.CORE_AUTHENTICATOR_CLASS, FakeAuthenticator.class.getName());
SecurityRealmFactory factory = new SecurityRealmFactory(settings, new SecurityRealm[] { realm }, new LoginPasswordAuthenticator[] { authenticator });
assertThat(factory.getRealm()).isSameAs(realm);
}
use of org.sonar.api.security.LoginPasswordAuthenticator in project sonarqube by SonarSource.
the class CompatibilityRealmTest method shouldDelegate.
@Test
public void shouldDelegate() {
LoginPasswordAuthenticator authenticator = mock(LoginPasswordAuthenticator.class);
CompatibilityRealm realm = new CompatibilityRealm(authenticator);
realm.init();
verify(authenticator).init();
assertThat(realm.getLoginPasswordAuthenticator()).isSameAs(authenticator);
assertThat(realm.getName()).isEqualTo("CompatibilityRealm[" + authenticator.getClass().getName() + "]");
}
Aggregations