Search in sources :

Example 1 with ActiveDirectoryConfig

use of com.epam.reportportal.auth.store.entity.ldap.ActiveDirectoryConfig in project service-authorization by reportportal.

the class ActiveDirectoryAuthProvider method getDelegate.

@Override
protected AuthenticationProvider getDelegate() {
    ActiveDirectoryConfig adConfig = authConfigRepository.findActiveDirectory(true).orElseThrow(() -> new BadCredentialsException("Active Directory is not configured"));
    ActiveDirectoryLdapAuthenticationProvider adAuth = new ActiveDirectoryLdapAuthenticationProvider(adConfig.getDomain(), adConfig.getUrl(), adConfig.getBaseDn());
    adAuth.setAuthoritiesMapper(new NullAuthoritiesMapper());
    adAuth.setUserDetailsContextMapper(new DetailsContextMapper(ldapUserReplicator, adConfig.getSynchronizationAttributes()));
    return adAuth;
}
Also used : ActiveDirectoryConfig(com.epam.reportportal.auth.store.entity.ldap.ActiveDirectoryConfig) ActiveDirectoryLdapAuthenticationProvider(org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider) BadCredentialsException(org.springframework.security.authentication.BadCredentialsException) NullAuthoritiesMapper(org.springframework.security.core.authority.mapping.NullAuthoritiesMapper)

Example 2 with ActiveDirectoryConfig

use of com.epam.reportportal.auth.store.entity.ldap.ActiveDirectoryConfig in project service-authorization by reportportal.

the class AbstractAuthSequenceProviderTest method shouldFailValidationWithNullInputValuesForTextField.

@Test
public void shouldFailValidationWithNullInputValuesForTextField() {
    ActiveDirectoryConfig adConfig = new ActiveDirectoryConfig();
    adConfig.setEnabled(true);
    final Set<ConstraintViolation<ActiveDirectoryConfig>> constrants = validator.validate(adConfig);
    Assert.assertThat(constrants.size(), CoreMatchers.is(3));
}
Also used : ActiveDirectoryConfig(com.epam.reportportal.auth.store.entity.ldap.ActiveDirectoryConfig) ConstraintViolation(javax.validation.ConstraintViolation) Test(org.junit.Test)

Aggregations

ActiveDirectoryConfig (com.epam.reportportal.auth.store.entity.ldap.ActiveDirectoryConfig)2 ConstraintViolation (javax.validation.ConstraintViolation)1 Test (org.junit.Test)1 BadCredentialsException (org.springframework.security.authentication.BadCredentialsException)1 NullAuthoritiesMapper (org.springframework.security.core.authority.mapping.NullAuthoritiesMapper)1 ActiveDirectoryLdapAuthenticationProvider (org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider)1