내 GWT의 첫 번째 페이지 애플리케이션 "/HumanResources.html"에 대한 액세스를 보호하기 위해 스프링 보안을 사용하고 있습니다. 사용자 자격 증명이 올바른지 (LDAP 콘텐츠와 비교하여) 사용자가 데이터베이스 (사용자 정의 인증 표)에 있는지 확인합니다.로그 아웃 후 GWT + 스프링 보안 로그인 문제
처음으로 사용자가 로그인해도 문제가없는 경우 사용자 로그 아웃과 ".jsp"페이지가 표시됩니다. 하지만 "HumanResources.html"페이지에 다시 액세스하려고하면 인증이 무시됩니다 (로그인 양식이 표시되지 않음). 페이지가 표시됩니다. 인터페이스 만 표시되며 보안 RPC 서비스에서 데이터를 검색합니다.
이 문제는 외부 Tomcat Server (Firefox 및 Chrome에서 테스트 됨)에는 표시되지만 GWT Dev 모드에는 표시되지 않습니다. CTRL + F5가 작동하는 것 같고 다른 캐시 문제를 찾았지만 도움이되지 않았습니다.
아무도 도와 줄 수 있습니까?
내 보안 applicationContext.xml의 일부 :
<http use-expressions="true" auto-config="false">
<intercept-url pattern="/HumanResources.html" access="isAuthenticated()" />
<form-login
login-page='/login.jsp'
authentication-failure-url = "/login.jsp?login_error=1"
authentication-success-handler-ref="HRAuthenticationHandler" />
<logout
logout-url="/logout"
logout-success-url="/logout.jsp"
delete-cookies="JSESSIONID"/>
</http>
<beans:bean id="HRAuthenticationHandler" class="lu.sfeir.candidate.server.auth.HRAuthenticationHandler">
<beans:property name="useReferer" value="true" />
</beans:bean>
<ldap-server url="${ldap.serverUrl}" manager-dn="${ldap.adminLogin}" manager-password="${ldap.adminPassword}" />
<authentication-manager>
<ldap-authentication-provider
group-search-base="${ldap.groups}"
user-search-base="${ldap.users}"
user-search-filter="${ldap.userId}">
</ldap-authentication-provider>
</authentication-manager>
내 사용자 정의 AuthenticationHandler를 구현 :
public class HRAuthenticationHandler extends SavedRequestAwareAuthenticationSuccessHandler {
@Autowired
private AuthorizedUsersDao usersDao;
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException,
ServletException {
// Check if the user exist in the DB
if(usersDao.findUser(((UserDetails)authentication.getPrincipal()).getUsername())) {
// Redirect to home page
super.onAuthenticationSuccess(request, response, authentication);
} else {
// Redirect to error page
response.sendRedirect("/spring_security_login?login_error");
}
}
}
답장을 보내 주셔서 감사합니다. HumanResources.html에 액세스 역할 (ROLE_HR)을 추가하여 해결책을 시도했지만 작동하지 않았습니다. :/다시 로그 할 때 인증 단계가 "건너 뛰었습니다"... – ersefuril
다시 한번 감사드립니다! HTML 헤더가 최상의 솔루션 일 수 있습니다 (소수의 사용자가 응용 프로그램에 연결됨). 난 항상이 솔루션을 보았지만, 내가 시도한 지난 번에 작동하지 않았다 (어쩌면 내가 잘못하고있다). 어떻게 대처할 수 있는지 보여 주시겠습니까? – ersefuril
우리는 그것을한다 2) 길 - 코드는 나의 지위에있다. onFailure의 RPC에서는 보안 예외를 처리합니다 –