Answer the question
In order to leave comments, you need to log in
Why doesn't spring security let some requests through?
Hello. Help, please, to solve a problem.
Set up Spring security
<http realm="JavaStudy example" use-expressions="false"
authentication-manager-ref="dao-auth"
access-decision-manager-ref="accessDecisionManager">
<intercept-url pattern="/admin**" access="Manager"/>
<intercept-url pattern="/user**" access="userAvailable"/>
<!--<intercept-url pattern="/admin/admin**" access="Manager"/>-->
<!--<intercept-url pattern="/user/user**" access="userAvailable"/>-->
<form-login login-page="/login" authentication-failure-url="/login-denied"
username-parameter="username" password-parameter="password"
default-target-url="/main"/>
<logout invalidate-session="true" logout-success-url="/"
logout-url="/"/>
<access-denied-handler error-page="/denied"/>
<session-management invalid-session-url="/">
<concurrency-control max-sessions="1"
expired-url="/login"/>
</session-management>
<!--remember me-->
<remember-me token-validity-seconds="1209600"
remember-me-parameter="remember-me"
user-service-ref="userDetailsService"/>
</http>
@RequestMapping(value = "/userNumberOperations", method = RequestMethod.GET)
public String userNumberOperations(HttpServletRequest request, Locale locale, Model model) {
User user = (User) request.getSession().getAttribute("currentUser");
model.addAttribute("contracts", contractService.getAllContractsForUser(user.getUserId()));
return "user/userNumberOperations";
}
@RequestMapping(value = "/userNumberOperations", method = RequestMethod.POST)
public String userNumberOperations(HttpServletRequest request, Locale locale, Model model) {
User user = (User) request.getSession().getAttribute("currentUser");
model.addAttribute("contracts", contractService.getAllContractsForUser(user.getUserId()));
return "user/userNumberOperations";
}
var xhr = new XMLHttpRequest();
xhr.open("POST", "userNumberOperations, false);
xhr.send();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question