aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-01 10:48:14 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-01 10:48:14 +1300
commit416ea87605b13f329430fbbb6a4aa1c002086514 (patch)
tree16f693c9cec8df8967f12fe987387a81282064a2 /src/org/traccar/api
parented7e73b5af4e4e84f3abd2dde73626f90de911bb (diff)
downloadtrackermap-server-416ea87605b13f329430fbbb6a4aa1c002086514.tar.gz
trackermap-server-416ea87605b13f329430fbbb6a4aa1c002086514.tar.bz2
trackermap-server-416ea87605b13f329430fbbb6a4aa1c002086514.zip
Rename CORS response filter
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);
}
+
}