| .. | .. |
|---|
| 34 | 34 | // @PreMatching |
|---|
| 35 | 35 | @Priority(Priorities.AUTHENTICATION) |
|---|
| 36 | 36 | public class SecurityInterceptor implements javax.ws.rs.container.ContainerRequestFilter { |
|---|
| 37 | | - private static final Logger log = LogManager.getLogger(SecurityInterceptor.class); |
|---|
| 37 | + private static final Logger LOG = LogManager.getLogger(SecurityInterceptor.class); |
|---|
| 38 | 38 | |
|---|
| 39 | 39 | @Inject |
|---|
| 40 | 40 | private TokenHelper tokenHelper; |
|---|
| .. | .. |
|---|
| 59 | 59 | return; |
|---|
| 60 | 60 | String token = servletRequest.getHeader(TokenHelper.TOKEN_HEADER_PÀRAM); |
|---|
| 61 | 61 | if (token == null || !tokenHelper.isTokenValid(token)) { |
|---|
| 62 | | - log.info("Access denied to '{}', Token not valid.", servletRequest.getPathInfo()); |
|---|
| 62 | + LOG.info("Access denied to '{}', Token not valid.", servletRequest.getPathInfo()); |
|---|
| 63 | 63 | containerRequestContext.abortWith(Response.status(Status.UNAUTHORIZED).build()); |
|---|
| 64 | 64 | } else { |
|---|
| 65 | 65 | Securable sec = method.getAnnotation(Securable.class); |
|---|
| .. | .. |
|---|
| 69 | 69 | int userRoles = getUserRoles(username); |
|---|
| 70 | 70 | // if (sec.roles() != 0) { |
|---|
| 71 | 71 | // if ((sec.roles() & userRoles) == 0) { |
|---|
| 72 | | - // log.info("User {} has no necessary role to access url: {}", username, servletRequest.getPathInfo()); |
|---|
| 72 | + // LOG.info("User {} has no necessary role to access url: {}", username, servletRequest.getPathInfo()); |
|---|
| 73 | 73 | // containerRequestContext.abortWith(Response.status(Status.UNAUTHORIZED).build()); |
|---|
| 74 | 74 | // } |
|---|
| 75 | 75 | // } |
|---|
| .. | .. |
|---|
| 80 | 80 | containerRequestContext.setSecurityContext(scw); |
|---|
| 81 | 81 | // Next line provide injection in resource methods |
|---|
| 82 | 82 | ResteasyProviderFactory.pushContext(BasicSecurityContext.class, scw); |
|---|
| 83 | | - log.debug("Added custom SecurityContext for user {}, orgs: {}", username, orgs); |
|---|
| 83 | + LOG.debug("Added custom SecurityContext for user {}, orgs: {}", username, orgs); |
|---|
| 84 | 84 | } |
|---|
| 85 | 85 | } |
|---|
| 86 | 86 | |
|---|