Mercurial > lada > lada-server
changeset 271:f7b5ff46f3e7
Added service to get so general information on the service like loggend in
user etc.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Thu, 25 Jul 2013 11:44:26 +0200 |
parents | a6185d60c2a1 |
children | 0ddcc6240d47 |
files | src/main/java/de/intevation/lada/rest/InfoService.java |
diffstat | 1 files changed, 59 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/rest/InfoService.java Thu Jul 25 11:44:26 2013 +0200 @@ -0,0 +1,59 @@ +package de.intevation.lada.rest; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.inject.Named; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.UriInfo; + +import de.intevation.lada.auth.Authentication; +import de.intevation.lada.auth.AuthenticationException; + +/** + * This class produces a RESTful service to read, write and update + * LOrt objects. + * + * @author <a href="mailto:torsten.irlaender@intevation.de">Torsten Irländer</a> + */ +@Path("/info") +@RequestScoped +public class InfoService +{ + /** + * The authorization module. + */ + @Inject + @Named("ldapauth") + private Authentication authentication; + + /** + * Request SQL-Queries + * + * Query parameters are used for the filter in form of key-value pairs. + * + * @param info The URL query parameters. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ + @GET + @Produces("text/json") + public Response filter( + @Context UriInfo info, + @Context HttpHeaders headers + ) { + try { + if (!authentication.isAuthorizedUser(headers)) { + return new Response(false, 699, null); + } + Response response = new Response(true, 200, null); + return response; + } + catch(AuthenticationException ae) { + return new Response(false, 699, null); + } + } +}