Search in sources :

Example 6 with SecurityRealm

use of org.sonar.api.security.SecurityRealm 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);
}
Also used : SecurityRealm(org.sonar.api.security.SecurityRealm) LoginPasswordAuthenticator(org.sonar.api.security.LoginPasswordAuthenticator) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 SecurityRealm (org.sonar.api.security.SecurityRealm)6 LoginPasswordAuthenticator (org.sonar.api.security.LoginPasswordAuthenticator)2 SonarException (org.sonar.api.utils.SonarException)1