세션의 시작 부분에서 세션 변수를 잡고 결과에 따라 특정 페이지에 대한 액세스 만 허용하려는 간단한 사용 사례가 있습니다. 나는 모든 페이지에서 @Get 또는 @Post 메서드를 가로 채기 위해 bindInterceptor를 사용하여 가장 잘 수행되었거나 필터를 사용하는 것이 더 낫다는 것이 확실하지 않습니다. 여기에 내가 할 수 있지만하고 싶은 무엇을 스케치 대안에 개방하고 있습니다 :bindInterceptor와 guice 보안을위한 필터?
At the start of a new session (@SessionScoped ?), check a session variable authentication token
If (authentication == admin) {
serveRegex("admin/(jsp|html)/.*").with(GuiceContainer.class); //only allow /admin subpages
req.getRequestDispatcher("/admin").forward(req, res); //fwd all initial page requests to /admin
}
else If (authentication == user) {
serveRegex("user/(jsp|html)/.*").with(GuiceContainer.class); //only allow /user subpages
req.getRequestDispatcher("/user").forward(req, res); //fwd all initial page requests to /user
}
else {
serveRegex("signin/(jsp|html)/.*").with(GuiceContainer.class); //only allow /signin subpages
req.getRequestDispatcher("/signin").forward(req, res); //fwd all initial page requests to /signin
}
어떤 기법이 보안 모델을 관리하기위한 선호 된 접근 (적어도 코드, 빠른, 등)? 나는 예제 프로젝트를보고 싶다.
도움 주셔서 감사합니다.
-john