Ignore:
Timestamp:
Nov 20, 2012, 4:56:35 PM (11 years ago)
Author:
casties
Branch:
default
Message:

new non-authorized mode without tokens. enabled by default. configured with annotationmanager.authorization=false property.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java

    r52 r57  
    133133
    134134    /**
    135      * checks Annotator Auth plugin authentication information from headers.
    136      * returns userId if successful.
     135     * Checks Annotator Auth plugin authentication information from headers.
     136     * Returns userId if successful. Returns "anonymous" in non-authorization mode.
    137137     *
    138138     * @param entity
     
    142142        Form requestHeaders = (Form) getRequest().getAttributes().get("org.restlet.http.headers");
    143143        String authToken = requestHeaders.getFirstValue("x-annotator-auth-token", true);
    144         if (authToken == null) return null;
     144        if (authToken == null) {
     145            if (!((BaseRestlet) getApplication()).isAuthorizationMode()) {
     146                return "anonymous";
     147            }
     148            return null;
     149        }
    145150        // decode token first to get consumer key
    146151        JsonToken token = new JsonTokenParser(null, null).deserialize(authToken);
Note: See TracChangeset for help on using the changeset viewer.