use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminRealm method doGetAuthenticationInfo.
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
String username = ((UsernamePasswordToken) token).getUsername();
Settings settings = getSettings();
return getAccount(username, settings);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class IniWebEnvironment method addLdapProperties.
protected void addLdapProperties(Ini ini) {
Settings settings = getSettingsService().getSettings();
if (settings != null) {
String ldapUrl = String.format("ldap://%s:%s", settings.getLdapServerHost(), settings.getLdapServerPort());
ini.setSectionProperty(IniSecurityManagerFactory.MAIN_SECTION_NAME, ActiveDirectoryRealm.REALM_NAME, "com.artezio.arttime.security.auth.ActiveDirectoryRealm");
ini.setSectionProperty(IniSecurityManagerFactory.MAIN_SECTION_NAME, ActiveDirectoryRealm.REALM_NAME + ".url", ldapUrl);
ini.setSectionProperty(IniSecurityManagerFactory.MAIN_SECTION_NAME, ActiveDirectoryRealm.REALM_NAME + ".systemUsername", settings.getLdapPrincipalUsername());
ini.setSectionProperty(IniSecurityManagerFactory.MAIN_SECTION_NAME, ActiveDirectoryRealm.REALM_NAME + ".systemPassword", settings.getLdapBindCredentials());
ini.setSectionProperty(IniSecurityManagerFactory.MAIN_SECTION_NAME, ActiveDirectoryRealm.REALM_NAME + ".searchBase", settings.getLdapUserContextDN());
ini.setSectionProperty(IniSecurityManagerFactory.MAIN_SECTION_NAME, ActiveDirectoryRealm.REALM_NAME + ".principalSuffix", settings.getLdapPrincipalSuffix());
ini.setSectionProperty(IniSecurityManagerFactory.MAIN_SECTION_NAME, ActiveDirectoryRealm.REALM_NAME + ".groupRolesMap", getGroupRolesMapProperty(settings));
}
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminRealmTest method testdoGetAuthenticationInfo.
@Test
public void testdoGetAuthenticationInfo() {
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setAdminUsername("admin");
AuthenticationToken token = new UsernamePasswordToken("admin", new char[] {});
PowerMock.mockStatic(CDIUtils.class);
expect(CDIUtils.getBean(SettingsService.class)).andReturn(settingsService);
expect(settingsService.getSettings()).andReturn(settings);
PowerMock.replayAll(CDIUtils.class, settingsService);
AuthenticationInfo actual = adminRealm.doGetAuthenticationInfo(token);
PowerMock.verifyAll();
assertNotNull(actual);
assertTrue(actual instanceof SimpleAccount);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminRealmTest method testDoGetAuthorizationInfo.
@Test
public void testDoGetAuthorizationInfo() {
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setAdminUsername("admin");
PrincipalCollection principalCollection = new SimplePrincipalCollection("admin", "realm");
PowerMock.mockStatic(CDIUtils.class);
expect(CDIUtils.getBean(SettingsService.class)).andReturn(settingsService);
expect(settingsService.getSettings()).andReturn(settings);
PowerMock.replayAll(CDIUtils.class, settingsService);
AuthorizationInfo actual = adminRealm.doGetAuthorizationInfo(principalCollection);
PowerMock.verifyAll();
assertNotNull(actual);
assertTrue(actual instanceof SimpleAccount);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminRealmTest method testGetAccount_ifLoggedUserIsAdmin.
@Test
public void testGetAccount_ifLoggedUserIsAdmin() {
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setAdminUsername("admin");
SimpleAccount actual = adminRealm.getAccount("admin", settings);
assertNotNull(actual);
}
Aggregations