[DEV] add logs in auth verifications ...
This commit is contained in:
parent
f84dc6b4e7
commit
e1fad71085
@ -4,6 +4,7 @@ import org.kar.karideo.model.User;
|
||||
import org.kar.karideo.model.UserSmall;
|
||||
|
||||
import javax.annotation.Priority;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Priorities;
|
||||
import javax.ws.rs.container.ContainerRequestContext;
|
||||
import javax.ws.rs.container.ContainerRequestFilter;
|
||||
@ -33,14 +34,24 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
||||
System.out.println("-----------------------------------------------------");
|
||||
System.out.println("---- Check if have authorization ----");
|
||||
System.out.println("-----------------------------------------------------");
|
||||
System.out.println(" for:" + requestContext);
|
||||
// Get the Authorization header from the request
|
||||
String authorizationHeader = requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);
|
||||
System.out.println("authorizationHeader: " + authorizationHeader);
|
||||
|
||||
|
||||
System.out.println(" -------------------------------");
|
||||
// this get the parameters inside the pre-parsed element in the request ex: @Path("thumbnail/{id}") generate a map with "id"
|
||||
MultivaluedMap<String, String> pathparam = requestContext.getUriInfo().getPathParameters();
|
||||
for (Entry<String, List<String>> item: pathparam.entrySet()) {
|
||||
System.out.println(" map element: " + item.getKey() + " ==>" + item.getValue());
|
||||
System.out.println(" param: " + item.getKey() + " ==>" + item.getValue());
|
||||
}
|
||||
System.out.println(" -------------------------------");
|
||||
MultivaluedMap<String, String> headers = requestContext.getHeaders();
|
||||
for (Entry<String, List<String>> item: headers.entrySet()) {
|
||||
System.out.println(" headers: " + item.getKey() + " ==>" + item.getValue());
|
||||
}
|
||||
System.out.println(" -------------------------------");
|
||||
|
||||
// Validate the Authorization header
|
||||
if (!isTokenBasedAuthentication(authorizationHeader)) {
|
||||
abortWithUnauthorized(requestContext);
|
||||
|
@ -333,7 +333,7 @@ public class DataResource {
|
||||
public Response uploadFile(@Context SecurityContext sc, @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileMetaData) {
|
||||
GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
||||
System.out.println("===================================================");
|
||||
System.out.println("== DATA uploadFile " + gc.user);
|
||||
System.out.println("== DATA uploadFile " + (gc==null?"null":gc.user));
|
||||
System.out.println("===================================================");
|
||||
//public NodeSmall uploadFile(final FormDataMultiPart form) {
|
||||
System.out.println("Upload file: ");
|
||||
|
Loading…
Reference in New Issue
Block a user