Revision 57792
Added by Michele Artini over 4 years ago
MyAccessDeniedHandler.java | ||
---|---|---|
14 | 14 |
import org.springframework.security.web.access.AccessDeniedHandler; |
15 | 15 |
import org.springframework.stereotype.Component; |
16 | 16 |
|
17 |
import eu.dnetlib.organizations.controller.UserInfo; |
|
18 |
|
|
17 | 19 |
@Component |
18 | 20 |
public class MyAccessDeniedHandler implements AccessDeniedHandler { |
19 | 21 |
|
... | ... | |
29 | 31 |
logger.warn(String.format("User '%s' attempted to access the protected URL: %s", auth.getName(), req.getRequestURI())); |
30 | 32 |
} |
31 | 33 |
|
32 |
res.sendRedirect(req.getContextPath() + "/authorizationRequest"); |
|
34 |
if (UserInfo.isNotAuthorized(auth)) { |
|
35 |
res.sendRedirect(req.getContextPath() + "/authorizationRequest"); |
|
36 |
} else { |
|
37 |
res.sendRedirect(req.getContextPath() + "/alreadyRegistered"); |
|
38 |
} |
|
33 | 39 |
} |
34 | 40 |
|
35 | 41 |
} |
Also available in: Unified diff