Mercurial > hg > AnnotationManagerN4J
changeset 49:f30f42080711
first steps for authorization for annotations ui.
author | casties |
---|---|
date | Thu, 27 Sep 2012 12:39:15 +0200 |
parents | 0e00bf8e27fb |
children | 64aa756c60cc |
files | src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java Wed Sep 26 18:10:47 2012 +0200 +++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java Thu Sep 27 12:39:15 2012 +0200 @@ -6,7 +6,10 @@ import org.apache.log4j.Logger; import org.restlet.Context; import org.restlet.Restlet; +import org.restlet.data.ChallengeScheme; import org.restlet.routing.Router; +import org.restlet.security.ChallengeAuthenticator; +import org.restlet.security.MapVerifier; import de.mpiwg.itgroup.annotations.restlet.BaseRestlet; @@ -47,13 +50,18 @@ router.attach("/persons/{id}/", PersonResource.class); router.attach("/", InfoResource.class); - // authenticator.setNext(router); - // return authenticator; - return router; + // Create a simple password verifier + MapVerifier verifier = new MapVerifier(); + verifier.getLocalSecrets().put("scott", "tiger".toCharArray()); + // Create a Guard + ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC, "Tutorial"); + guard.setVerifier(verifier); + // put everything through guard + guard.setNext(router); + return guard; } - @Override public String getVersion() { return version;