Při napojování uživatele z AD se login převede na malá písmena. Opravena chyba při mazání uživatele.

closes #237
Verze_3.0
Josef Rokos 9 years ago
parent 10439b5001
commit d1ccaf530d

@ -5,9 +5,6 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.services.users.LdapUserImporter; import info.bukova.isspst.services.users.LdapUserImporter;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import java.util.Collection;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.ldap.core.DirContextOperations; import org.springframework.ldap.core.DirContextOperations;
@ -15,6 +12,8 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator; import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator;
import java.util.Collection;
public class AuthPopulator implements LdapAuthoritiesPopulator { public class AuthPopulator implements LdapAuthoritiesPopulator {
private UserService userService; private UserService userService;
@ -30,7 +29,8 @@ public class AuthPopulator implements LdapAuthoritiesPopulator {
public Collection<? extends GrantedAuthority> getGrantedAuthorities( public Collection<? extends GrantedAuthority> getGrantedAuthorities(
DirContextOperations userData, String login) { DirContextOperations userData, String login) {
User user = null; User user;
try { try {
user = (User) userService.loadUserByUsername(login); user = (User) userService.loadUserByUsername(login);
} catch (UsernameNotFoundException e) { } catch (UsernameNotFoundException e) {

@ -3,9 +3,6 @@ package info.bukova.isspst.services.users;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.security.AuthMethod; import info.bukova.isspst.security.AuthMethod;
import java.util.Collection;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.ldap.core.DirContextAdapter; import org.springframework.ldap.core.DirContextAdapter;
@ -16,6 +13,8 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider; import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider;
import org.springframework.security.ldap.userdetails.UserDetailsContextMapper; import org.springframework.security.ldap.userdetails.UserDetailsContextMapper;
import java.util.Collection;
/** /**
* Mapovač doménových uživatelů Active Directory na uživatele aplikace. Pokud uživatel není v aplikační databází, * Mapovač doménových uživatelů Active Directory na uživatele aplikace. Pokud uživatel není v aplikační databází,
* importu je se tam pomoci {@link LdapUserImporter}. Tento objekt se předává do {@link ActiveDirectoryLdapAuthenticationProvider}. * importu je se tam pomoci {@link LdapUserImporter}. Tento objekt se předává do {@link ActiveDirectoryLdapAuthenticationProvider}.
@ -40,6 +39,7 @@ public class AdUserCtxMapper implements UserDetailsContextMapper {
@Override @Override
public UserDetails mapUserFromContext(DirContextOperations userData, public UserDetails mapUserFromContext(DirContextOperations userData,
String username, Collection<? extends GrantedAuthority> authorities) { String username, Collection<? extends GrantedAuthority> authorities) {
username = username.toLowerCase();
try { try {
User user = (User) userService.loadUserByUsername(username); User user = (User) userService.loadUserByUsername(username);

@ -7,15 +7,7 @@ import info.bukova.isspst.data.UserSettingsData;
import info.bukova.isspst.security.AuthMethod; import info.bukova.isspst.security.AuthMethod;
import info.bukova.isspst.services.AbstractService; import info.bukova.isspst.services.AbstractService;
import info.bukova.isspst.services.StringXmlMarshaller; import info.bukova.isspst.services.StringXmlMarshaller;
//import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.Unmarshaller;
import org.hibernate.LazyInitializationException; import org.hibernate.LazyInitializationException;
@ -31,6 +23,13 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
//import info.bukova.isspst.services.LazyLoader;
public class UserServiceImpl extends AbstractService<User> implements UserService { public class UserServiceImpl extends AbstractService<User> implements UserService {
private PasswordEncoder encoder; private PasswordEncoder encoder;
@ -220,6 +219,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
} }
@Override @Override
@Transactional
public void delete(User entity) { public void delete(User entity) {
workgroupService.loadParents(entity); workgroupService.loadParents(entity);

Loading…
Cancel
Save