UserDetailLoader 추가

master
mjkhan21 1 year ago
parent b3b098a344
commit 7e1c3dd72a

@ -66,6 +66,12 @@
<version>23.04.01-SNAPSHOT</version> <version>23.04.01-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.egovframe.rte</groupId>
<artifactId>org.egovframe.rte.fdl.crypto</artifactId>
<version>${org.egovframe.rte.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -0,0 +1,5 @@
package cokr.xit.base.security;
public interface UserDetailLoader {
void setInfo(SecuredUserInfo userInfo);
}

@ -6,6 +6,7 @@ import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -17,6 +18,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import cokr.xit.base.security.AccessContext; import cokr.xit.base.security.AccessContext;
import cokr.xit.base.security.Authority; import cokr.xit.base.security.Authority;
import cokr.xit.base.security.SecuredUserInfo; import cokr.xit.base.security.SecuredUserInfo;
import cokr.xit.base.security.UserDetailLoader;
import cokr.xit.base.security.access.dao.AuthorityMapper; import cokr.xit.base.security.access.dao.AuthorityMapper;
import cokr.xit.base.security.authentication.AuthenticationPolicy; import cokr.xit.base.security.authentication.AuthenticationPolicy;
import cokr.xit.base.security.authentication.service.AuthenticationService; import cokr.xit.base.security.authentication.service.AuthenticationService;
@ -45,6 +47,8 @@ public class AuthenticationServiceBean extends DaoAuthenticationProvider impleme
/** 접근 권한 DAO */ /** 접근 권한 DAO */
@Resource(name="authorityMapper") @Resource(name="authorityMapper")
private AuthorityMapper authorityMapper; private AuthorityMapper authorityMapper;
@Autowired(required = false)
private UserDetailLoader userDetailLoader;
/** AuthenticationServiceBean . /** AuthenticationServiceBean .
*/ */
@ -69,7 +73,7 @@ public class AuthenticationServiceBean extends DaoAuthenticationProvider impleme
SecuredUserInfo userInfo = new SecuredUserInfo(); SecuredUserInfo userInfo = new SecuredUserInfo();
userInfo.setUser(user); userInfo.setUser(user);
setAuthorities(userInfo); setAuthorities(userInfo);
loadDetails(userInfo); setDetails(userInfo);
return userInfo; return userInfo;
} }
@ -121,8 +125,7 @@ public class AuthenticationServiceBean extends DaoAuthenticationProvider impleme
SecuredUserInfo userInfo = new SecuredUserInfo(); SecuredUserInfo userInfo = new SecuredUserInfo();
userInfo.setUser(user); userInfo.setUser(user);
setAuthorities(userInfo); setAuthorities(userInfo);
loadDetails(userInfo); setDetails(userInfo);
return userInfo; return userInfo;
} }
@ -141,7 +144,10 @@ public class AuthenticationServiceBean extends DaoAuthenticationProvider impleme
/** . /** .
* @param user * @param user
*/ */
protected void loadDetails(UserInfo user) {} protected void setDetails(SecuredUserInfo userInfo) {
if (userDetailLoader != null)
userDetailLoader.setInfo(userInfo);
}
/** . /** .
* @param authIDs * @param authIDs

Loading…
Cancel
Save