Package com.google.step2.example.consumer.appengine

Examples of com.google.step2.example.consumer.appengine.Openid4javaFetcher$TooLargeResponse


  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


  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

  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

  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

  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

  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

    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

    assertInputStreamIsClosed(response);
  }

  public void testGet_syntaxError() 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

    assertInputStreamIsClosed(response);
  }

  public void testGet_fetchException() throws Exception {
    String host = "host.com";
    FetchRequest request =
        FetchRequest.createGetRequest(new URI("http://host.com/host-meta"));

    expect(http.fetch(request)).andThrow(new FetchException());

    control.replay();
View Full Code Here

    control.verify();
  }

  public void testGet_httpErrorCode() throws Exception {
    String host = "host.com";
    FetchRequest request =
        FetchRequest.createGetRequest(new URI("http://host.com/host-meta"));
    FetchResponse response = new FakeFetchResponse(400, "error");

    expect(http.fetch(request)).andReturn(response);
View Full Code Here

TOP

Related Classes of com.google.step2.example.consumer.appengine.Openid4javaFetcher$TooLargeResponse

Copyright © 2018 www.massapicom. 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.