diff --git a/src/main/java/nlib/security/SpringSecurityConfig.java b/src/main/java/nlib/security/SpringSecurityConfig.java index cdce67d2..50cfa776 100644 --- a/src/main/java/nlib/security/SpringSecurityConfig.java +++ b/src/main/java/nlib/security/SpringSecurityConfig.java @@ -1,7 +1,11 @@ package nlib.security; +import javax.servlet.http.HttpServletRequest; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.security.access.annotation.Secured; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; @@ -13,9 +17,13 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; import nlib.cmm.crypto.NlibPasswordEncoder; import nlib.cmm.service.NlibProperty; +import nlib.user.service.NlibLoginVO; /** *
@@ -62,50 +70,30 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/**").permitAll()
- .and().csrf()
- .disable();
- /*
- .antMatchers("/login/**").permitAll()
- .antMatchers("/member/*.do").permitAll()
- .antMatchers("/member/*.ajax").permitAll()
- .antMatchers("/member/naver/*.do").permitAll()
- .antMatchers("/member/google/*.do").permitAll()
- .antMatchers("/member/kakao/*.do").permitAll()
- .antMatchers("/userInfo/*.do").permitAll()
- .antMatchers("/info/inform/*.do").permitAll()
- .antMatchers("/").permitAll()
- .antMatchers("/index.jsp").permitAll()
- .antMatchers("/index.do").permitAll()
- .antMatchers("/main/header.do").permitAll()
- .antMatchers("/main/menu.do").permitAll()
- .antMatchers("/rent/*.do").permitAll()
- .antMatchers("/collection/*.do").permitAll()
- .antMatchers("/sample/password/getSampleEncoder.do").permitAll()
- .antMatchers("/sample/*.do").permitAll()
- .antMatchers("/ * / *Ajax.do").permitAll()
- .antMatchers("/fileupload/**").permitAll()
- .antMatchers("/board/**").permitAll()
- .antMatchers("/inform/**").permitAll()
- .antMatchers("/test/**").permitAll()
- .antMatchers("/alert/**").permitAll()
- .antMatchers("/code/**").permitAll()
- .antMatchers("/homes/**").permitAll()
- .antMatchers("/homes/**").permitAll()
- .antMatchers("/cart/**").permitAll()
- .antMatchers("/bbs/**").permitAll()
- .antMatchers("/search/**").permitAll()
- .antMatchers("/*.html").permitAll()
- .anyRequest().authenticated()
.and().formLogin()
- .loginPage(NlibProperty.getString("login.url"))
+ .loginPage(NlibProperty.getString("login.url") + "?login=req")
.permitAll()
.and().csrf()
.disable();
- */
http.logout()
.logoutSuccessUrl("/login/logout.do")
.invalidateHttpSession(true).deleteCookies("JSESSIONID")
;
+
+ //--------------------------------------
+ // 안내
+ //--------------------------------------
+ // 로그인이 필요한 컨에 대하여 컨트롤러의 해당 함수에
+ // @Secured(SecUserVO.ROLE_USER)
+ // 선언할 것
+ //
+ // (ex)
+ //
+ // @Secured("ROLE_USER")
+ // @RequestMapping(value="/userInfo/getMyHome.do")
+ // public String getMyHome(HttpServletRequest request, ModelMap model) throws Exception { ... }
+ //--------------------------------------
+
}
@Bean
diff --git a/src/main/java/nlib/user/web/LoginController.java b/src/main/java/nlib/user/web/LoginController.java
index 89e4ae20..4e70544e 100644
--- a/src/main/java/nlib/user/web/LoginController.java
+++ b/src/main/java/nlib/user/web/LoginController.java
@@ -225,7 +225,8 @@ public class LoginController extends NlibCommonController {
HttpServletResponse res,
@RequestParam(required = false) String callType,
@RequestParam(required = false) String returnUrl,
- @RequestParam(required = false) String logout,
+ @RequestParam(required = false) String login,
+ @RequestParam(required = false) String logout,
@RequestParam(required = false) String error,
@RequestParam(required = false) String message,
RedirectAttributes redirectAttrs,
@@ -283,6 +284,8 @@ public class LoginController extends NlibCommonController {
model.addAttribute("message", "로그아웃되었습니다. 감사합니다.");
}
+ model.addAttribute("login", login); // "req"인 경우, 로그인 필수 안내 표출
+
String retScreen = "nlib/login/loginFormPopup";
if(OAuthLogin.CALL_TYPE_MEMBER.equalsIgnoreCase(callType)) retScreen = "nlib/login/memberSnsForm";
else if(reqPath.equalsIgnoreCase("/login/loginForm.do")) retScreen = "nlib/login/loginForm";
diff --git a/src/main/java/nlib/user/web/UserInfoController.java b/src/main/java/nlib/user/web/UserInfoController.java
index 8128d98b..4ed39cbb 100644
--- a/src/main/java/nlib/user/web/UserInfoController.java
+++ b/src/main/java/nlib/user/web/UserInfoController.java
@@ -20,6 +20,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.annotation.Secured;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@@ -39,6 +40,7 @@ import nlib.col.service.ReadService;
import nlib.col.service.RentService;
import nlib.restful.service.DataApiResVO;
import nlib.security.SecUserDetailsService;
+import nlib.security.SecUserVO;
import nlib.user.service.LoginService;
import nlib.user.service.NlibLoginVO;
import nlib.user.service.UserInfoService;
@@ -292,13 +294,13 @@ public class UserInfoController extends NlibCommonController {
* @return
* @throws Exception
*/
+ @Secured("ROLE_USER")
@RequestMapping(value="/userInfo/getMyHome.do")
public String getMyHome(HttpServletRequest request, ModelMap model) throws Exception {
NlibLoginVO loginVO = getNlibLoginVO(request);
log.debug("getMemberQrcode : loginVO=" + loginVO.toString());
- // 로그인 계정 정보 추가 DDDDDDDDDDDDDDDDdd
model.addAttribute("loginVO", loginVO);
// 이전접속정보
diff --git a/src/main/webapp/WEB-INF/jsp/nlib/login/loginForm.jsp b/src/main/webapp/WEB-INF/jsp/nlib/login/loginForm.jsp
index 00b13a7c..db8d874f 100644
--- a/src/main/webapp/WEB-INF/jsp/nlib/login/loginForm.jsp
+++ b/src/main/webapp/WEB-INF/jsp/nlib/login/loginForm.jsp
@@ -38,23 +38,21 @@
-
+
로그인 섹션영역
-
-
- - HOME
- - 로그인
-
-
- - 로그인
-
-
-
+
+
+ 로그인 안내
+
+
+ 로그인 후, 이용해 주시기 바랍니다.
+
+
diff --git a/src/main/webapp/WEB-INF/jsp/nlib/login/loginMessage.jsp b/src/main/webapp/WEB-INF/jsp/nlib/login/loginMessage.jsp
index 3df4725b..e2f7ddf2 100644
--- a/src/main/webapp/WEB-INF/jsp/nlib/login/loginMessage.jsp
+++ b/src/main/webapp/WEB-INF/jsp/nlib/login/loginMessage.jsp
@@ -36,7 +36,12 @@
+
로그인 및 회원가입 안내
+
+
+ 로그인 안내
+