public ProxyUri process(Uri uri) throws GadgetException { return wrapped.process(uri); }
public ProxyUri process(Uri uri) throws GadgetException { return wrapped.process(uri); }
public ProxyUri process(Uri uri) throws GadgetException { return wrapped.process(uri); }
proxied = proxyUriManager.process(uri); } catch (GadgetException e) { return VisitStatus.BYPASS;
public Uri parseAndNormalize(HttpRequest httpRequest) throws GadgetException { Gadget gadget = DomWalker.makeGadget(httpRequest); ProxyUriManager.ProxyUri proxied = looksLikeAccelUri(httpRequest.getUri()) ? proxyUriManager.process(httpRequest.getUri()) : new ProxyUriManager.ProxyUri( gadget, httpRequest.getUri()); return proxyUriManager.make(ImmutableList.of(proxied), 0).get(0); }
private void setupRequest(String str, boolean ldSafe) throws Exception { Uri uri = Uri.parse(str); expect(request.getScheme()).andReturn(uri.getScheme()); expect(request.getServerName()).andReturn(uri.getAuthority()); expect(request.getServerPort()).andReturn(80); expect(request.getRequestURI()).andReturn(uri.getPath()); expect(request.getQueryString()).andReturn(uri.getQuery()); expect(request.getHeader("Host")).andReturn(uri.getAuthority()); expect(proxyUriManager.process(uri)).andReturn(proxyUri); expect(lockedDomainService.isSafeForOpenProxy(uri.getAuthority())).andReturn(ldSafe); }
public Uri parseAndNormalize(HttpRequest httpRequest) throws GadgetException { Gadget gadget = DomWalker.makeGadget(httpRequest); ProxyUriManager.ProxyUri proxied = looksLikeAccelUri(httpRequest.getUri()) ? proxyUriManager.process(httpRequest.getUri()) : new ProxyUriManager.ProxyUri( gadget, httpRequest.getUri()); return proxyUriManager.make(ImmutableList.of(proxied), 0).get(0); }
private void setupRequest(String str, boolean ldSafe) throws Exception { Uri uri = Uri.parse(str); expect(request.getScheme()).andReturn(uri.getScheme()); expect(request.getServerName()).andReturn(uri.getAuthority()); expect(request.getServerPort()).andReturn(80); expect(request.getRequestURI()).andReturn(uri.getPath()); expect(request.getQueryString()).andReturn(uri.getQuery()); expect(request.getHeader("Host")).andReturn(uri.getAuthority()); expect(proxyUriManager.process(uri)).andReturn(proxyUri); expect(lockedDomainService.isSafeForOpenProxy(uri.getAuthority())).andReturn(ldSafe); }
private void setupRequest(String str, boolean ldSafe) throws Exception { Uri uri = Uri.parse(str); expect(request.getScheme()).andReturn(uri.getScheme()); expect(request.getServerName()).andReturn(uri.getAuthority()); expect(request.getServerPort()).andReturn(80); expect(request.getRequestURI()).andReturn(uri.getPath()); expect(request.getQueryString()).andReturn(uri.getQuery()); expect(request.getHeader("Host")).andReturn(uri.getAuthority()); expect(proxyUriManager.process(uri)).andReturn(proxyUri); expect(lockedDomainService.isSafeForOpenProxy(uri.getAuthority())).andReturn(ldSafe); }
public Uri parseAndNormalize(HttpRequest httpRequest) throws GadgetException { // Make a gadget object with the accel container. Gadget gadget = DomWalker.makeGadget(httpRequest); gadget.setContext(new GadgetContext(gadget.getContext()) { @Override public String getContainer() { return AccelUriManager.CONTAINER; } }); // Normalize the request url to proxy uri form. ProxyUriManager.ProxyUri proxied = looksLikeAccelUri(httpRequest.getUri()) ? proxyUriManager.process(httpRequest.getUri()) : new ProxyUriManager.ProxyUri( gadget, httpRequest.getUri()); return proxyUriManager.make(ImmutableList.of(proxied), 0).get(0); }
@Test public void testDoGetWithOAuth2() throws Exception { Map<String, String> options = new HashMap<String, String>(); options.put("OAUTH_SERVICE_NAME", "example"); ProxyUriManager.ProxyUri proxyUri = new ProxyUri(-1, false, true, "default", "http://example.org/gadget.xml", REQUEST_URL); proxyUri.setAuthType(AuthType.OAUTH2); Uri uri = Uri.parse(BASIC_SYNTAX_URL + "&authz=oauth2&OAUTH_SERVICE_NAME=example&container=default&gadget=http://example.org/gadget.xml"); expect(proxyUriManager.process(uri)).andReturn(proxyUri); expect(request.getScheme()).andReturn(uri.getScheme()); expect(request.getServerName()).andReturn(uri.getAuthority()); expect(request.getServerPort()).andReturn(80); expect(request.getRequestURI()).andReturn(uri.getPath()); expect(request.getQueryString()).andReturn(uri.getQuery()); expect(request.getHeader("Host")).andReturn(uri.getAuthority()); expect(request.getParameter("OAUTH_SERVICE_NAME")).andReturn("example"); expect(request.getParameterNames()).andReturn(Collections.enumeration(options.keySet())); expect(lockedDomainService.isSafeForOpenProxy(uri.getAuthority())).andReturn(true); ProxyUriManager.ProxyUri pUri = new ProxyUri(-1, false, true, "default", "http://example.org/gadget.xml", REQUEST_URL); pUri.setAuthType(AuthType.OAUTH2); pUri.setOAuth2Arguments(new OAuth2Arguments(AuthType.OAUTH2, options)); expect(proxyHandler.fetch(pUri)).andReturn(new HttpResponse(RESPONSE_BODY)); replay(); servlet.doGet(request, recorder); verify(); assertResponseOk(HttpResponse.SC_OK, RESPONSE_BODY); }
try { ProxyUriManager.ProxyUri proxyUri = proxyUriManager.process(reqUri);
@Test public void testDoGetWithOAuth() throws Exception { Map<String, String> options = new HashMap<String, String>(); options.put("OAUTH_SERVICE_NAME", "example"); ProxyUriManager.ProxyUri proxyUri = new ProxyUri(-1, false, true, "default", "http://example.org/gadget.xml", REQUEST_URL); proxyUri.setAuthType(AuthType.OAUTH); Uri uri = Uri.parse(BASIC_SYNTAX_URL + "&authz=oauth&OAUTH_SERVICE_NAME=example&container=default&gadget=http://example.org/gadget.xml"); expect(proxyUriManager.process(uri)).andReturn(proxyUri); expect(request.getScheme()).andReturn(uri.getScheme()); expect(request.getServerName()).andReturn(uri.getAuthority()); expect(request.getServerPort()).andReturn(80); expect(request.getRequestURI()).andReturn(uri.getPath()); expect(request.getQueryString()).andReturn(uri.getQuery()); expect(request.getHeader("Host")).andReturn(uri.getAuthority()); expect(request.getParameter("OAUTH_SERVICE_NAME")).andReturn("example"); expect(request.getParameterNames()).andReturn(Collections.enumeration(options.keySet())); expect(lockedDomainService.isSafeForOpenProxy(uri.getAuthority())).andReturn(true); ProxyUriManager.ProxyUri pUri = new ProxyUri(-1, false, true, "default", "http://example.org/gadget.xml", REQUEST_URL); pUri.setAuthType(AuthType.OAUTH); pUri.setOAuthArguments(new OAuthArguments(AuthType.OAUTH, options)); expect(proxyHandler.fetch(pUri)).andReturn(new HttpResponse(RESPONSE_BODY)); replay(); servlet.doGet(request, recorder); verify(); assertResponseOk(HttpResponse.SC_OK, RESPONSE_BODY); } }
try { ProxyUriManager.ProxyUri proxyUri = proxyUriManager.process(reqUri);
@Test public void testDoGetWithOAuth2() throws Exception { Map<String, String> options = new HashMap<String, String>(); options.put("OAUTH_SERVICE_NAME", "example"); ProxyUriManager.ProxyUri proxyUri = new ProxyUri(-1, false, true, "default", "http://example.org/gadget.xml", REQUEST_URL); proxyUri.setAuthType(AuthType.OAUTH2); Uri uri = Uri.parse(BASIC_SYNTAX_URL + "&authz=oauth2&OAUTH_SERVICE_NAME=example&container=default&gadget=http://example.org/gadget.xml"); expect(proxyUriManager.process(uri)).andReturn(proxyUri); expect(request.getScheme()).andReturn(uri.getScheme()); expect(request.getServerName()).andReturn(uri.getAuthority()); expect(request.getServerPort()).andReturn(80); expect(request.getRequestURI()).andReturn(uri.getPath()); expect(request.getQueryString()).andReturn(uri.getQuery()); expect(request.getHeader("Host")).andReturn(uri.getAuthority()); expect(request.getParameter("OAUTH_SERVICE_NAME")).andReturn("example"); expect(request.getParameterNames()).andReturn(Collections.enumeration(options.keySet())); expect(lockedDomainService.isSafeForOpenProxy(uri.getAuthority())).andReturn(true); ProxyUriManager.ProxyUri pUri = new ProxyUri(-1, false, true, "default", "http://example.org/gadget.xml", REQUEST_URL); pUri.setAuthType(AuthType.OAUTH2); pUri.setOAuth2Arguments(new OAuth2Arguments(AuthType.OAUTH2, options)); expect(proxyHandler.fetch(pUri)).andReturn(new HttpResponse(RESPONSE_BODY)); replay(); servlet.doGet(request, recorder); verify(); assertResponseOk(HttpResponse.SC_OK, RESPONSE_BODY); }
@Test public void testDoGetWithOAuth() throws Exception { Map<String, String> options = new HashMap<String, String>(); options.put("OAUTH_SERVICE_NAME", "example"); ProxyUriManager.ProxyUri proxyUri = new ProxyUri(-1, false, true, "default", "http://example.org/gadget.xml", REQUEST_URL); proxyUri.setAuthType(AuthType.OAUTH); Uri uri = Uri.parse(BASIC_SYNTAX_URL + "&authz=oauth&OAUTH_SERVICE_NAME=example&container=default&gadget=http://example.org/gadget.xml"); expect(proxyUriManager.process(uri)).andReturn(proxyUri); expect(request.getScheme()).andReturn(uri.getScheme()); expect(request.getServerName()).andReturn(uri.getAuthority()); expect(request.getServerPort()).andReturn(80); expect(request.getRequestURI()).andReturn(uri.getPath()); expect(request.getQueryString()).andReturn(uri.getQuery()); expect(request.getHeader("Host")).andReturn(uri.getAuthority()); expect(request.getParameter("OAUTH_SERVICE_NAME")).andReturn("example"); expect(request.getParameterNames()).andReturn(Collections.enumeration(options.keySet())); expect(lockedDomainService.isSafeForOpenProxy(uri.getAuthority())).andReturn(true); ProxyUriManager.ProxyUri pUri = new ProxyUri(-1, false, true, "default", "http://example.org/gadget.xml", REQUEST_URL); pUri.setAuthType(AuthType.OAUTH); pUri.setOAuthArguments(new OAuthArguments(AuthType.OAUTH, options)); expect(proxyHandler.fetch(pUri)).andReturn(new HttpResponse(RESPONSE_BODY)); replay(); servlet.doGet(request, recorder); verify(); assertResponseOk(HttpResponse.SC_OK, RESPONSE_BODY); } }
@Test public void processPassesThrough() throws Exception { Capture<Uri> uriCapture = new Capture<Uri>(); expect(uriManager.process(capture(uriCapture))).andReturn(proxyUri).once(); replay(uriManager); SanitizingProxyUriManager rewriter = makeRewriter(null); ProxyUri returned = rewriter.process(uri); verify(uriManager); assertSame(uri, uriCapture.getValue()); assertSame(returned, proxyUri); }
@Test public void processPassesThrough() throws Exception { Capture<Uri> uriCapture = new Capture<Uri>(); expect(uriManager.process(capture(uriCapture))).andReturn(proxyUri).once(); replay(uriManager); SanitizingProxyUriManager rewriter = makeRewriter(null); ProxyUri returned = rewriter.process(uri); verify(uriManager); assertSame(uri, uriCapture.getValue()); assertSame(returned, proxyUri); }
@Test public void processPassesThrough() throws Exception { Capture<Uri> uriCapture = new Capture<Uri>(); expect(uriManager.process(capture(uriCapture))).andReturn(proxyUri).once(); replay(uriManager); SanitizingProxyUriManager rewriter = makeRewriter(null); ProxyUri returned = rewriter.process(uri); verify(uriManager); assertSame(uri, uriCapture.getValue()); assertSame(returned, proxyUri); }
try { ProxyUriManager.ProxyUri proxyUri = proxyUriManager.process(reqUri); SecurityToken st = AuthInfoUtil.getSecurityTokenFromRequest(request); proxyUri.setSecurityToken(st);