로그인 작업중.
parent
a0390e0b3a
commit
40318e86ef
|
|
@ -18,7 +18,7 @@ function EgovLoginContent(props) {
|
|||
const location = useLocation();
|
||||
console.log("EgovLoginContent [location] : ", location);
|
||||
|
||||
const [userInfo, setUserInfo] = useState({ id: '', password: 'default', userSe: 'USR' });
|
||||
const [userInfo, setUserInfo] = useState({ username: '', password: 'default', userSe: 'USR' });
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [loginVO, setLoginVO] = useState({});
|
||||
|
||||
|
|
@ -55,14 +55,14 @@ function EgovLoginContent(props) {
|
|||
useEffect(() => {
|
||||
let data = getLocalItem(KEY_ID);
|
||||
if (data !== null) {
|
||||
setUserInfo({ id: data, password: 'default', userSe: 'USR' });
|
||||
setUserInfo({ username: data, password: 'default', userSe: 'USR' });
|
||||
}
|
||||
}, []);
|
||||
|
||||
const submitFormHandler = (e) => {
|
||||
console.log("EgovLoginContent submitFormHandler()");
|
||||
|
||||
const loginUrl = "/auth/login-jwt"
|
||||
const loginUrl = "/auth/login"
|
||||
const requestOptions = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
@ -111,8 +111,8 @@ function EgovLoginContent(props) {
|
|||
<fieldset>
|
||||
<legend>로그인</legend>
|
||||
<span className="group">
|
||||
<input type="text" name="" title="아이디" placeholder="아이디" value={userInfo?.id}
|
||||
onChange={e => setUserInfo({ ...userInfo, id: e.target.value })} />
|
||||
<input type="text" name="" title="아이디" placeholder="아이디" value={userInfo?.username}
|
||||
onChange={e => setUserInfo({ ...userInfo, username: e.target.value })} />
|
||||
<input type="password" name="" title="비밀번호" placeholder="비밀번호"
|
||||
onChange={e => setUserInfo({ ...userInfo, password: e.target.value })} />
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ public class EgovLoginApiController extends BaseController {
|
|||
|
||||
|
||||
@Operation(
|
||||
summary = "JWT 로그인",
|
||||
description = "JWT 로그인 처리",
|
||||
summary = "회원가입",
|
||||
description = "회원가입",
|
||||
tags = {"EgovLoginApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ import org.springframework.security.config.annotation.web.configurers.AbstractHt
|
|||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.web.DefaultRedirectStrategy;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
|
||||
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
|
|
@ -100,8 +102,7 @@ public class SecurityConfig {
|
|||
}
|
||||
@Bean
|
||||
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
|
||||
return http.csrf(AbstractHttpConfigurer::disable)
|
||||
http.csrf(AbstractHttpConfigurer::disable)
|
||||
.authorizeHttpRequests(authorize -> authorize
|
||||
.antMatchers(AUTH_WHITELIST).permitAll()
|
||||
.antMatchers(HttpMethod.GET,AUTH_GET_WHITELIST).permitAll()
|
||||
|
|
@ -115,7 +116,14 @@ public class SecurityConfig {
|
|||
exceptionHandlingConfigurer
|
||||
.authenticationEntryPoint(new JwtAuthenticationEntryPoint())
|
||||
)
|
||||
.build();
|
||||
.cors().and()
|
||||
.formLogin().loginProcessingUrl("/auth/login")
|
||||
.successHandler(loginSuccessHandler())
|
||||
.and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
|
||||
.logoutSuccessUrl("/")
|
||||
.invalidateHttpSession(true)
|
||||
.deleteCookies("JSESSIONID");
|
||||
return http.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
@ -130,4 +138,5 @@ public class SecurityConfig {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue