로그인 성공시 권한별로 페이지 이동
CustomLoginSuccessHandler 생성
- 로그인 성공시 권한별로 페이지 이동
상속 - 오버라이딩 - 객체생성(security-context)
servlet-context
시큐리티 관련 객체 생성
로그인 시 아무 화면도 안뜸
CustomLoginSuccessHandler
사용자의 권한 정보를 저장
람다식 사용하여 함수 호출
ctrl+1 ⇒
람다식을 기존 오버라이딩 형태로 변환해줌
각 권한별로 페이지 이동
package com.itwillbs.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping(value = "/sample/*")
public class SampleController {
private static final Logger logger = LoggerFactory.getLogger(SampleController.class);
//http://localhost:8088/sample/all
@RequestMapping(value = "/all",method = RequestMethod.GET)
public void doALL() throws Exception{
logger.debug("/sample/all -> doALL() 실행");
}
//http://localhost:8088/sample/member
@RequestMapping(value = "/member",method = RequestMethod.GET)
public void doMember() throws Exception{
logger.debug("/sample/member -> doMember() 실행");
}
//http://localhost:8088/sample/admin
@RequestMapping(value = "/admin",method = RequestMethod.GET)
public void doAdmin() throws Exception{
logger.debug("/sample/adminb -> doAdmin() 실행");
}
}
'⛏️ > Spring' 카테고리의 다른 글
[Spring] 비밀번호 암호화, 회원정보에 따른 권한 설정 (0) | 2023.12.29 |
---|---|
[Spring] 로그아웃 (0) | 2023.12.29 |
[Spring] 시큐리티 설정 (0) | 2023.12.26 |
[Spring] 파일 업로드 ver. (0) | 2023.12.22 |
[Spring] 페이징 처리 ver. (0) | 2023.12.21 |