@Test(expected = WebApplicationException.class) public void testAuthenticateLocalRequestMissing() { this.authUtil.authenticateLocalRequest(this.mockRequest); }
public void authenticateLocalRequest(ContainerRequestContext request) { WebApplicationException wae = new WebApplicationException( Response.status(Response.Status.UNAUTHORIZED).entity("not authorized").build()); if(request.getUriInfo()!=null && request.getUriInfo().getRequestUri()!=null) { String remoteAddr = request.getUriInfo().getRequestUri().getHost(); if (remoteAddr == null || !(remoteAddr.equals("127.0.0.1") || remoteAddr.equals("localhost"))) { throw wae; } } else { throw wae; } }
AuthUtil { public void authenticateLocalRequest(ContainerRequestContext request) { WebApplicationException wae = new WebApplicationException( Response.status(Response.Status.UNAUTHORIZED).entity("not authorized").build()); if(request.getUriInfo()!=null && request.getUriInfo().getRequestUri()!=null) { String remoteAddr = request.getUriInfo().getRequestUri().getHost(); if (remoteAddr == null || !(remoteAddr.equals("127.0.0.1") || remoteAddr.equals("localhost"))) { throw wae; } } else { throw wae; } } }
AuthUtil { public void authenticateLocalRequest(ContainerRequestContext request) { WebApplicationException wae = new WebApplicationException( Response.status(Response.Status.UNAUTHORIZED).entity("not authorized").build()); if(request.getUriInfo()!=null && request.getUriInfo().getRequestUri()!=null) { String remoteAddr = request.getUriInfo().getRequestUri().getHost(); if (remoteAddr == null || !(remoteAddr.equals("127.0.0.1") || remoteAddr.equals("localhost"))) { throw wae; } } else { throw wae; } }  }
AuthUtil { public void authenticateLocalRequest(ContainerRequestContext request) { WebApplicationException wae = new WebApplicationException( Response.status(Response.Status.UNAUTHORIZED).entity("not authorized").build()); if(request.getUriInfo()!=null && request.getUriInfo().getRequestUri()!=null) { String remoteAddr = request.getUriInfo().getRequestUri().getHost(); if (remoteAddr == null || !(remoteAddr.equals("127.0.0.1") || remoteAddr.equals("localhost"))) { throw wae; } } else { throw wae; } }  void authenticate(ContainerRequestContext request, String validUserName, String validPass); void authenticate(ContainerRequestContext request, Map<String, String> usernamePasswordMap); void authenticateLocalRequest(ContainerRequestContext request); }
AuthUtil { public void authenticateLocalRequest(ContainerRequestContext request) { WebApplicationException wae = new WebApplicationException( Response.status(Response.Status.UNAUTHORIZED).entity("not authorized").build()); if(request.getUriInfo()!=null && request.getUriInfo().getRequestUri()!=null) { String remoteAddr = request.getUriInfo().getRequestUri().getHost(); if (remoteAddr == null || !(remoteAddr.equals("127.0.0.1") || remoteAddr.equals("localhost"))) { throw wae; } } else { throw wae; } }  void authenticate(ContainerRequestContext request, String validUserName, String validPass); void authenticate(ContainerRequestContext request, Map<String, String> usernamePasswordMap); void authenticateLocalRequest(ContainerRequestContext request);  }