@Test @DirtiesContext public void testGetByUsernameDashboard() throws Exception { final OnmsUser newUser = new OnmsUser("dashboard"); newUser.setPassword("DC7161BE3DBF2250C8954E560CC35060"); m_userManager.save(newUser); OnmsUser user = ((SpringSecurityUserDao) m_springSecurityDao).getByUsername("dashboard"); assertNotNull("user object should not be null", user); assertEquals("OnmsUser name", "dashboard", user.getUsername()); assertEquals("Full name", null, user.getFullName()); assertEquals("Comments", null, user.getComments()); assertEquals("Password", "DC7161BE3DBF2250C8954E560CC35060", user.getPassword()); Collection<? extends GrantedAuthority> authorities = user.getAuthorities(); assertNotNull("authorities should not be null", authorities); assertEquals("authorities size", 1, authorities.size()); assertEquals("authorities 0 name", Authentication.ROLE_DASHBOARD, authorities.iterator().next().getAuthority()); assertNoWarningsOrGreater(); }
@Override public OnmsUser getByUsername(String username) { reloadIfNecessary(); OnmsUser user; if (m_magicUsers.containsKey(username)) { user = m_magicUsers.get(username); } else { user = m_users.get(username); } if (user == null) { return null; } user.setAuthorities(getAuthoritiesByUsername(username)); return user; }
SpringSecurityUserDaoImpl implements SpringSecurityUserDao, InitializingBean { @Override public OnmsUser getByUsername(String username) { reloadIfNecessary(); OnmsUser user; if (m_magicUsers.containsKey(username)) { user = m_magicUsers.get(username); } else { user = m_users.get(username); } if (user == null) { return null; } user.setAuthorities(getAuthoritiesByUsername(username)); return user; } }
SpringSecurityUserDaoImpl implements SpringSecurityUserDao, InitializingBean { @Override public OnmsUser getByUsername(String username) { reloadIfNecessary(); OnmsUser user; if (m_magicUsers.containsKey(username)) { user = m_magicUsers.get(username); } else { user = m_users.get(username); } if (user == null) { return null; } user.setAuthorities(getAuthoritiesByUsername(username)); return user; } SpringSecurityUserDaoImpl(); }
SpringSecurityUserDaoImpl implements SpringSecurityUserDao, InitializingBean { @Override public OnmsUser getByUsername(String username) { reloadIfNecessary(); OnmsUser user; if (m_magicUsers.containsKey(username)) { user = m_magicUsers.get(username); } else { user = m_users.get(username); } if (user == null) { return null; } user.setAuthorities(getAuthoritiesByUsername(username)); return user; } SpringSecurityUserDaoImpl(); void parseMagicUsers(); void setUsersConfigurationFile(String usersConfigurationFile); void setGroupsConfigurationFile(String groupsConfigurationFile); void setUseGroups(boolean useGroups); String getUsersConfigurationFile(); void setMagicUsersConfigurationFile(String magicUsersConfigurationFile); String getMagicUsersConfigurationFile(); @Override OnmsUser getByUsername(String username); long getMagicUsersLastModified(); long getUsersLastModified(); long getGroupsLastModified(); boolean isUseGroups(); UserManager getUserManager(); void setUserManager(final UserManager mgr); GroupManager getGroupManager(); void setGroupManager(final GroupManager mgr); @Override void afterPropertiesSet(); }
SpringSecurityUserDaoImpl implements SpringSecurityUserDao, InitializingBean { @Override public OnmsUser getByUsername(String username) { reloadIfNecessary(); OnmsUser user; if (m_magicUsers.containsKey(username)) { user = m_magicUsers.get(username); } else { user = m_users.get(username); } if (user == null) { return null; } user.setAuthorities(getAuthoritiesByUsername(username)); return user; } SpringSecurityUserDaoImpl(); void parseMagicUsers(); void setUsersConfigurationFile(String usersConfigurationFile); void setGroupsConfigurationFile(String groupsConfigurationFile); void setUseGroups(boolean useGroups); String getUsersConfigurationFile(); void setMagicUsersConfigurationFile(String magicUsersConfigurationFile); String getMagicUsersConfigurationFile(); @Override OnmsUser getByUsername(String username); long getMagicUsersLastModified(); long getUsersLastModified(); long getGroupsLastModified(); boolean isUseGroups(); UserManager getUserManager(); void setUserManager(final UserManager mgr); GroupManager getGroupManager(); void setGroupManager(final GroupManager mgr); @Override void afterPropertiesSet();  }