Mercurial > hg > AnnotationManagerN4J
comparison src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java @ 86:e3f0613b2f2d
renamed getFullname to make it configurable.
fixed Restlet at 2.2.3.
author | casties |
---|---|
date | Mon, 02 Feb 2015 11:32:53 +0100 |
parents | ed51eadc82c5 |
children | b406507a953d |
comparison
equal
deleted
inserted
replaced
85:ed51eadc82c5 | 86:e3f0613b2f2d |
---|---|
161 * Checks Annotator Auth plugin authentication information from headers. | 161 * Checks Annotator Auth plugin authentication information from headers. |
162 * Returns userId if successful. Returns "anonymous" in non-authorization | 162 * Returns userId if successful. Returns "anonymous" in non-authorization |
163 * mode. | 163 * mode. |
164 * | 164 * |
165 * @param entity | 165 * @param entity |
166 * @return | 166 * @return user-id |
167 */ | 167 */ |
168 public String checkAuthToken(Representation entity) { | 168 public String checkAuthToken(Representation entity) { |
169 @SuppressWarnings("unchecked") | 169 @SuppressWarnings("unchecked") |
170 Series<Header> requestHeaders = (Series<Header>) getRequest().getAttributes().get("org.restlet.http.headers"); | 170 Series<Header> requestHeaders = (Series<Header>) getRequest().getAttributes().get("org.restlet.http.headers"); |
171 String authToken = requestHeaders.getFirstValue("x-annotator-auth-token", true); | 171 String authToken = requestHeaders.getFirstValue("x-annotator-auth-token", true); |
246 userObject.put("id", userId); | 246 userObject.put("id", userId); |
247 // get full name | 247 // get full name |
248 String userName = creator.getName(); | 248 String userName = creator.getName(); |
249 if (userName == null) { | 249 if (userName == null) { |
250 BaseRestlet restServer = (BaseRestlet) getApplication(); | 250 BaseRestlet restServer = (BaseRestlet) getApplication(); |
251 userName = restServer.getFullNameFromLdap(userId); | 251 userName = restServer.getFullNameForId(userId); |
252 } | 252 } |
253 userObject.put("name", userName); | 253 userObject.put("name", userName); |
254 // save user object | 254 // save user object |
255 jo.put("user", userObject); | 255 jo.put("user", userObject); |
256 } else { | 256 } else { |
622 username = authUser; | 622 username = authUser; |
623 } | 623 } |
624 // try to get full name | 624 // try to get full name |
625 if (creator.getName() == null && username != null) { | 625 if (creator.getName() == null && username != null) { |
626 BaseRestlet restServer = (BaseRestlet) getApplication(); | 626 BaseRestlet restServer = (BaseRestlet) getApplication(); |
627 String fullName = restServer.getFullNameFromLdap(username); | 627 String fullName = restServer.getFullNameForId(username); |
628 creator.setName(fullName); | 628 creator.setName(fullName); |
629 } | 629 } |
630 // userUri should be a URI, if not it will set to the MPIWG namespace | 630 // userUri should be a URI, if not it will set to the MPIWG namespace |
631 if (userUri == null) { | 631 if (userUri == null) { |
632 if (username.startsWith("http")) { | 632 if (username.startsWith("http")) { |