aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api')
-rw-r--r--src/org/traccar/api/CORSResponseFilter.java3
-rw-r--r--src/org/traccar/api/SecurityRequestFilter.java6
2 files changed, 3 insertions, 6 deletions
diff --git a/src/org/traccar/api/CORSResponseFilter.java b/src/org/traccar/api/CORSResponseFilter.java
index 89b49fc84..8aab5ad68 100644
--- a/src/org/traccar/api/CORSResponseFilter.java
+++ b/src/org/traccar/api/CORSResponseFilter.java
@@ -20,7 +20,7 @@ import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
-public class CORSResponseFilter implements ContainerResponseFilter {
+public class CorsResponseFilter implements ContainerResponseFilter {
public static final String ACCESS_CONTROL_ALLOW_ORIGIN_KEY = "Access-Control-Allow-Origin";
public static final String ACCESS_CONTROL_ALLOW_ORIGIN_VALUE = "*";
@@ -49,4 +49,5 @@ public class CORSResponseFilter implements ContainerResponseFilter {
response.getHeaders().add(ACCESS_CONTROL_ALLOW_METHODS_KEY, ACCESS_CONTROL_ALLOW_METHODS_VALUE);
}
}
+
}
diff --git a/src/org/traccar/api/SecurityRequestFilter.java b/src/org/traccar/api/SecurityRequestFilter.java
index e52df661b..8dbd2bbb0 100644
--- a/src/org/traccar/api/SecurityRequestFilter.java
+++ b/src/org/traccar/api/SecurityRequestFilter.java
@@ -35,18 +35,15 @@ public class SecurityRequestFilter implements ContainerRequestFilter {
public void filter(ContainerRequestContext requestContext) {
Method method = resourceInfo.getResourceMethod();
- //@PermitAll
if (method.isAnnotationPresent(PermitAll.class)) {
return;
}
- //@DenyAll
if (method.isAnnotationPresent(DenyAll.class)) {
requestContext.abortWith(ResponseBuilder.forbidden());
return;
}
- //AuthorizationBasic
UserPrincipal userPrincipal = AuthorizationBasic.getUserPrincipal(requestContext);
if (userPrincipal == null
|| userPrincipal.getName() == null
@@ -56,7 +53,6 @@ public class SecurityRequestFilter implements ContainerRequestFilter {
return;
}
- //@RolesAllowed
if (method.isAnnotationPresent(RolesAllowed.class)) {
RolesAllowed rolesAnnotation = method.getAnnotation(RolesAllowed.class);
Set<String> roles = new HashSet<>(Arrays.asList(rolesAnnotation.value()));
@@ -66,7 +62,6 @@ public class SecurityRequestFilter implements ContainerRequestFilter {
}
}
- //SecurityContext
requestContext.setSecurityContext(new SecurityContextApi(userPrincipal));
}
@@ -77,4 +72,5 @@ public class SecurityRequestFilter implements ContainerRequestFilter {
private boolean isAuthorizedUser(UserPrincipal userPrincipal, Set<String> roles) {
return AuthorizationBasic.isAuthorizedUser(userPrincipal, roles);
}
+
}