diff src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java @ 88:b406507a953d

upped version to 0.5. can use display name and groups from auth token.
author casties
date Tue, 03 Feb 2015 19:01:27 +0100
parents 25eb2e1df106
children cf44d9e1a4a7
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java	Tue Feb 03 11:33:45 2015 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java	Tue Feb 03 19:01:27 2015 +0100
@@ -1,7 +1,3 @@
-/**
- * Implements the "annotations" uri of the Annotator API. see
- * <https://github.com/okfn/annotator/wiki/Storage>
- */
 package de.mpiwg.itgroup.annotations.restlet;
 
 /*
@@ -87,7 +83,7 @@
         }
 
         // do authentication
-        Person authUser = Person.createPersonWithId(this.checkAuthToken(entity));
+        Person authUser = getUserFromAuthToken(entity);
         logger.fine("request authenticated=" + authUser);
 
         if (id == null) {
@@ -172,7 +168,7 @@
         setCorsHeaders();
 
         // do authentication TODO: who's allowed to create?
-        Person authUser = Person.createPersonWithId(this.checkAuthToken(entity));
+        Person authUser = getUserFromAuthToken(entity);
         logger.fine("request authenticated=" + authUser);
         if (authUser == null) {
             setStatus(Status.CLIENT_ERROR_FORBIDDEN, "Not Authorized!");
@@ -189,7 +185,7 @@
             }
             // make sure id is not set for POST
             jo.remove("id");
-            // get Annotation object from posted JSON
+            // create Annotation object from posted JSON
             annot = createAnnotation(jo, entity);
         } catch (IOException e1) {
             setStatus(Status.SERVER_ERROR_INTERNAL);
@@ -230,7 +226,7 @@
         logger.fine("annotation-id=" + id);
 
         // do authentication
-        Person authUser = Person.createPersonWithId(this.checkAuthToken(entity));
+        Person authUser = getUserFromAuthToken(entity);
         logger.fine("request authenticated=" + authUser);
 
         Annotation annot = null;
@@ -293,7 +289,7 @@
         logger.fine("annotation-id=" + id);
 
         // do authentication
-        Person authUser = Person.createPersonWithId(this.checkAuthToken(entity));
+        Person authUser = getUserFromAuthToken(entity);
         logger.fine("request authenticated=" + authUser);
         AnnotationStore store = getAnnotationStore();
         Annotation annot = store.getAnnotationById(id);