diff options
Diffstat (limited to 'src/org/traccar/api/BaseResource.java')
-rw-r--r-- | src/org/traccar/api/BaseResource.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/org/traccar/api/BaseResource.java b/src/org/traccar/api/BaseResource.java index 5a05c6732..368df7166 100644 --- a/src/org/traccar/api/BaseResource.java +++ b/src/org/traccar/api/BaseResource.java @@ -15,5 +15,19 @@ */ package org.traccar.api; +import javax.ws.rs.core.SecurityContext; + public class BaseResource { + + @javax.ws.rs.core.Context + private SecurityContext securityContext; + + protected SecurityContext getSecurityContext() { + return securityContext; + } + + protected long getUserId() { + return ((UserPrincipal) securityContext.getUserPrincipal()).getUserId(); + } + } |