Examples of FetchRequest


Examples of com.google.step2.http.FetchRequest

    String signatureHref = signatureLocation.getTextTrim();
    if (signatureHref == null) {
      throw new XmlSimpleSignException("No SignatureLocation text found");
    }

    FetchRequest request = FetchRequest.createGetRequest(URI.create(signatureHref));
    try {
      FetchResponse r = fetcher.fetch(request);
      return EncodingUtil.decodeBase64(r.getContentAsBytes());
    } catch (FetchException e) {
      throw new XmlSimpleSignException("couldn't fetch signature from " +
View Full Code Here

Examples of com.google.step2.http.FetchRequest

    }

    public HttpResponseMessage execute(HttpMessage request,
        Map<String, Object> clientParams) throws IOException {
      try {
        FetchRequest fetchRequest;
        if ("post".equals(request.method.toLowerCase())) {
          fetchRequest = FetchRequest.createPostRequest(request.url.toURI());
        } else if ("head".equals(request.method.toLowerCase())) {
          fetchRequest = FetchRequest.createHeadRequest(request.url.toURI());
        } else {
View Full Code Here

Examples of com.google.step2.http.FetchRequest

  public void testFindOpEndpointsForSite() throws Exception {
    IdpIdentifier host = new IdpIdentifier("balfanz.net");
    URI siteXrdsUri = URI.create("http://example.com/xrds");

    FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);

    expect(verifier.verify(isA(byte[].class), (String) isNull()))
        .andStubThrow(new XmlSimpleSignException("no signature"));
    expect(fetcher.fetch(httpRequest)).andReturn(new FakeResponse(SITE_XRD));
View Full Code Here

Examples of com.google.step2.http.FetchRequest

  public void testFindOpEndpointsForUser_direct() throws Exception {
    UrlIdentifier user = new UrlIdentifier("http://balfanz.net/openid?id=12345");
    URI siteXrdsUri = URI.create("http://example.com/xrds");

    FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);

    expect(verifier.verify(isA(byte[].class), (String) isNull()))
        .andStubThrow(new XmlSimpleSignException("no signature"));
    expect(fetcher.fetch(httpRequest)).andReturn(new FakeResponse(USER_XRD));
View Full Code Here

Examples of com.google.step2.http.FetchRequest

  public void testFindOpEndpointsForUser_directWithLocalId() throws Exception {
    UrlIdentifier user = new UrlIdentifier("http://balfanz.net/openid?id=12345");
    URI siteXrdsUri = URI.create("http://example.com/xrds");

    FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);

    expect(verifier.verify(isA(byte[].class), (String) isNull()))
        .andStubThrow(new XmlSimpleSignException("no signature"));
    expect(fetcher.fetch(httpRequest)).andReturn(new FakeResponse(USER_XRD_WITH_LOCAL_ID));
View Full Code Here

Examples of com.google.step2.http.FetchRequest

  public void testFindOpEndpointsForUser_throughSiteXrds() throws Exception {
    UrlIdentifier user = new UrlIdentifier("http://balfanz.net/openid?id=12345");
    URI siteXrdsUri = URI.create("http://example.com/xrds");

    FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);

    expect(verifier.verify(isA(byte[].class), (String) isNull()))
        .andStubThrow(new XmlSimpleSignException("no signature"));
    expect(fetcher.fetch(httpRequest)).andReturn(new FakeResponse(SITE_XRD));

    String userXrdsUri = "https://www.google.com/accounts/o8/user-xrds?uri="
        + URLEncoder.encode(user.getIdentifier(), "UTF-8");

    FetchRequest nextRequest = FetchRequest.createGetRequest(URI.create(userXrdsUri));

    expect(fetcher.fetch(nextRequest)).andReturn(new FakeResponse(USER_XRD));

    control.replay();
    List<SecureDiscoveryInformation> result =
View Full Code Here

Examples of com.google.step2.http.FetchRequest

  public void testFindOpEndpointsForUser_throughSiteXrds_secure()
      throws Exception {
    UrlIdentifier user = new UrlIdentifier("http://balfanz.net/openid?id=12345");
    URI siteXrdsUri = URI.create("http://example.com/xrds");

    FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);
    VerificationResult verification = new VerificationResult(
        ImmutableList.of(
            CertConstantUtil.SERVER_PUB_CERT,
            CertConstantUtil.INTERMEDIATE_PUB_CERT));

    expect(fetcher.fetch(httpRequest)).andReturn(new FakeResponse(SITE_XRD));
    expect(verifier.verify(aryEq(SITE_XRD.getBytes()), (String) isNull()))
        .andReturn(verification);
    expect(validator.matches(CertConstantUtil.SERVER_PUB_CERT, "balfanz.net"))
        .andReturn(Boolean.TRUE);

    String userXrdsUri = "https://www.google.com/accounts/o8/user-xrds?uri="
        + URLEncoder.encode(user.getIdentifier(), "UTF-8");

    FetchRequest nextRequest = FetchRequest.createGetRequest(
        URI.create(userXrdsUri));

    expect(fetcher.fetch(nextRequest)).andReturn(new FakeResponse(USER_XRD));
    expect(verifier.verify(aryEq(USER_XRD.getBytes()), (String) isNull()))
        .andReturn(verification);
View Full Code Here

Examples of com.google.step2.http.FetchRequest

  public void testFindOpEndpointsForUser_throughSiteXrds_withNextAuthority()
      throws Exception {
    UrlIdentifier user = new UrlIdentifier("http://balfanz.net/openid?id=12345");
    URI siteXrdsUri = URI.create("http://example.com/xrds");

    FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);
    VerificationResult verification = new VerificationResult(
        ImmutableList.of(
            CertConstantUtil.SERVER_PUB_CERT,
            CertConstantUtil.INTERMEDIATE_PUB_CERT));

    expect(fetcher.fetch(httpRequest))
        .andReturn(new FakeResponse(SITE_XRD_NEXT_AUTHORITY));
    expect(verifier.verify(aryEq(SITE_XRD_NEXT_AUTHORITY.getBytes()),
        (String) isNull()))
        .andReturn(verification);
    expect(validator.matches(CertConstantUtil.SERVER_PUB_CERT, "balfanz.net"))
        .andReturn(Boolean.TRUE);

    String userXrdsUri = "https://www.google.com/accounts/o8/user-xrds?uri="
        + URLEncoder.encode(user.getIdentifier(), "UTF-8");

    FetchRequest nextRequest = FetchRequest.createGetRequest(
        URI.create(userXrdsUri));

    expect(fetcher.fetch(nextRequest)).andReturn(new FakeResponse(USER_XRD));
    expect(verifier.verify(aryEq(USER_XRD.getBytes()), (String) isNull()))
        .andReturn(verification);
View Full Code Here

Examples of com.google.step2.http.FetchRequest

  public void testFindOpEndpointsForUser_throughSiteXrds_SignatureInHeader()
      throws Exception {
    UrlIdentifier user = new UrlIdentifier("http://balfanz.net/openid?id=12345");
    URI siteXrdsUri = URI.create("http://example.com/xrds");

    FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);
    VerificationResult verification = new VerificationResult(
        ImmutableList.of(
            CertConstantUtil.SERVER_PUB_CERT,
            CertConstantUtil.INTERMEDIATE_PUB_CERT));
    FakeResponse siteResponse = new FakeResponse(SITE_XRD);
    siteResponse.setSignature("siteSig");

    FakeResponse userResponse = new FakeResponse(USER_XRD);
    userResponse.setSignature("userSig");

    expect(fetcher.fetch(httpRequest)).andReturn(siteResponse);
    expect(verifier.verify(aryEq(SITE_XRD.getBytes()), eq("siteSig")))
        .andReturn(verification);
    expect(validator.matches(CertConstantUtil.SERVER_PUB_CERT, "balfanz.net"))
        .andReturn(Boolean.TRUE);

    String userXrdsUri = "https://www.google.com/accounts/o8/user-xrds?uri="
        + URLEncoder.encode(user.getIdentifier(), "UTF-8");

    FetchRequest nextRequest = FetchRequest.createGetRequest(
        URI.create(userXrdsUri));

    expect(fetcher.fetch(nextRequest)).andReturn(userResponse);
    expect(verifier.verify(aryEq(USER_XRD.getBytes()), eq("userSig")))
        .andReturn(verification);
View Full Code Here

Examples of com.google.step2.http.FetchRequest

    fetcher = new DefaultHostMetaFetcher(http);
  }

  public void testGet() throws Exception {
    String host = "host.com";
    FetchRequest request =
        FetchRequest.createGetRequest(new URI("http://host.com/host-meta"));
    FetchResponse response = new FakeFetchResponse(200,
        "Link: <http://foo.com/bar>; rel=foobar; type=foo\n");

    expect(http.fetch(request)).andReturn(response);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.