Package com.google.step2.discovery

Examples of com.google.step2.discovery.XrdLocationSelectorTest


  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);

    control.replay();
    try {
View Full Code Here


    XRDS xrds;
    byte[] documentBytes;
    String signature;

    try {
      FetchResponse response = httpFetcher.fetch(request);

      documentBytes = response.getContentAsBytes();
      signature = response.getFirstHeader("Signature"); // could be null

      Document document =
          XmlUtil.getDocument(new ByteArrayInputStream(documentBytes));

      xrds = new XRDS(document.getDocumentElement(), false);
View Full Code Here

      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 " +
          signatureHref, e);
    }
  }
View Full Code Here

  public HostMeta getHostMeta(String host) throws HostMetaException {
    try {
      URI uri = getHostMetaUriForHost(host);
      FetchRequest request = FetchRequest.createGetRequest(uri);

      FetchResponse response = fetcher.fetch(request);

      int status = response.getStatusCode();

      if (status != HttpStatus.SC_OK) {
        throw new HttpResponseException(status, "fetching host-meta from " +
            host + " return status " + status);
      }

      return HostMeta.parseFromStream(response.getContentAsStream());

    } catch (FetchException e) {
      throw new HostMetaException(e);
    } catch (URISyntaxException e) {
      throw new HostMetaException(e);
View Full Code Here

  }

  public AuthRequestHelper requestOauthAuthorization(String consumerKey,
      String scope) {
    log.info("Requesting OauthAuthorization");
    hybridOauthRequest = new HybridOauthRequest(consumerKey, scope);
    return this;
  }
View Full Code Here

        // Handle any OAuth Request tokens
        String oauthRequestToken =
          (String) session.getAttribute("oauth_request_token");
        if (oauthRequestToken != null) {
          // This is a request token response
          HybridOauthResponse hybridResponse =
              new HybridOauthResponse(oauthRequestToken, "");
          try {
            responseMessage.addExtension(hybridResponse);
          } catch (MessageException e) {
            throw new ServletException(e);
          }
View Full Code Here

   */
  public AuthRequestHelper requestAxAttribute(String alias, String typeUri,
      boolean required, int count) {
    log.info("Request AX Attribute Alias: " + alias);
    if (axFetchRequest == null) {
      axFetchRequest = new FetchRequest2();
    }

    try {
      axFetchRequest.addAttribute(alias, typeUri, required, count);
    } catch (MessageException e) {
View Full Code Here

          userClaimedId, authenticatedAndApproved.booleanValue());

      if (responseMessage instanceof AuthSuccess) {
        // Try adding an AX Fetch Response
        String email = (String) session.getAttribute("email");
        FetchResponse2 fetchResponse = new FetchResponse2();
        try {
          if (email != null) {
            fetchResponse.addAttribute(Step2.AxSchema.EMAIL.getShortName(),
                Step2.AxSchema.EMAIL.getUri(), email);
          }
          String country = (String) session.getAttribute("country");
          if (country != null) {
            fetchResponse.addAttribute(Step2.AxSchema.COUNTRY.getShortName(),
                Step2.AxSchema.COUNTRY.getUri(), country);
          }
          responseMessage.addExtension(fetchResponse);
        } catch (MessageException e) {
          throw new ServletException(e);
View Full Code Here

            addAttributes(helper, request);

            HttpSession session = request.getRequest().getSession();
            AuthRequest authReq = helper.generateRequest();

            UiMessageRequest uiExtension = new UiMessageRequest();
            uiExtension.setIconRequest(true);
            authReq.addExtension(uiExtension);

            session.setAttribute(IdentityConstants.OpenId.DISC, helper.getDiscoveryInformation());

            if (request.getRealm() != null && request.getRealm().trim().length() != 0) {
View Full Code Here

    }
    return this;
  }

  public AuthRequestHelper requestUxIcon(boolean showIcon) {
    UiMessageRequest ui = getOrCreateUiRequest();
    ui.setIconRequest(showIcon);
    return this;
  }
View Full Code Here

TOP

Related Classes of com.google.step2.discovery.XrdLocationSelectorTest

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.