Examples of OAuthCallbackState


Examples of org.apache.shindig.gadgets.oauth.OAuthCallbackState

    this.stateCrypter = stateCrypter;
  }

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    OAuthCallbackState callbackState = new OAuthCallbackState(stateCrypter,
        req.getParameter(CALLBACK_STATE_PARAM));
    if (callbackState.getRealCallbackUrl() != null) {
      // Copy the query parameters from this URL over to the real URL.
      UriBuilder realUri = UriBuilder.parse(callbackState.getRealCallbackUrl());
      Map<String, List<String>> params = UriBuilder.splitParameters(req.getQueryString());
      for (String param : params.keySet()) {
        realUri.putQueryParameter(param, params.get(param));
      }
      realUri.removeQueryParameter(CALLBACK_STATE_PARAM);
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthCallbackState

  }
 
  @Test
  public void testServletWithCallback() throws Exception {
    BlobCrypter crypter = new BasicBlobCrypter("00000000000000000000".getBytes());
    OAuthCallbackState state = new OAuthCallbackState(crypter);
    OAuthCallbackServlet servlet = new OAuthCallbackServlet();
    servlet.setStateCrypter(crypter);   
    state.setRealCallbackUrl("http://www.example.com/callback");
    expect(request.getParameter("cs")).andReturn(state.getEncryptedState());
    expect(request.getQueryString()).andReturn("cs=foo&bar=baz");
    replay();
    servlet.doGet(this.request, this.recorder);
    verify();
    assertEquals(302, this.recorder.getHttpStatusCode());
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthCallbackState

  }
 
  @Test
  public void testServletWithCallback_noQueryParams() throws Exception {
    BlobCrypter crypter = new BasicBlobCrypter("00000000000000000000".getBytes());
    OAuthCallbackState state = new OAuthCallbackState(crypter);
    OAuthCallbackServlet servlet = new OAuthCallbackServlet();
    servlet.setStateCrypter(crypter);   
    state.setRealCallbackUrl("http://www.example.com/callback");
    expect(request.getParameter("cs")).andReturn(state.getEncryptedState());
    expect(request.getQueryString()).andReturn("cs=foo");
    replay();
    servlet.doGet(this.request, this.recorder);
    verify();
    assertEquals(302, this.recorder.getHttpStatusCode());
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthCallbackState

  }

  @Test
  public void testServletWithCallback() throws Exception {
    BlobCrypter crypter = new BasicBlobCrypter("00000000000000000000".getBytes());
    OAuthCallbackState state = new OAuthCallbackState(crypter);
    OAuthCallbackServlet servlet = new OAuthCallbackServlet();
    servlet.setStateCrypter(crypter);
    state.setRealCallbackUrl("http://www.example.com/callback");
    expect(request.getParameter("cs")).andReturn(state.getEncryptedState());
    expect(request.getQueryString()).andReturn("cs=foo&bar=baz");
    replay();
    servlet.doGet(this.request, this.recorder);
    verify();
    assertEquals(302, this.recorder.getHttpStatusCode());
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthCallbackState

  }

  @Test
  public void testServletWithCallback_noQueryParams() throws Exception {
    BlobCrypter crypter = new BasicBlobCrypter("00000000000000000000".getBytes());
    OAuthCallbackState state = new OAuthCallbackState(crypter);
    OAuthCallbackServlet servlet = new OAuthCallbackServlet();
    servlet.setStateCrypter(crypter);
    state.setRealCallbackUrl("http://www.example.com/callback");
    expect(request.getParameter("cs")).andReturn(state.getEncryptedState());
    expect(request.getQueryString()).andReturn("cs=foo");
    replay();
    servlet.doGet(this.request, this.recorder);
    verify();
    assertEquals(302, this.recorder.getHttpStatusCode());
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthCallbackState

    this.stateCrypter = stateCrypter;
  }

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    OAuthCallbackState callbackState = new OAuthCallbackState(stateCrypter,
        req.getParameter(CALLBACK_STATE_PARAM));
    if (callbackState.getRealCallbackUrl() != null) {
      // Copy the query parameters from this URL over to the real URL.
      UriBuilder realUri = UriBuilder.parse(callbackState.getRealCallbackUrl());
      Map<String, List<String>> params = UriBuilder.splitParameters(req.getQueryString());
      for (Map.Entry<String, List<String>> entry : params.entrySet()) {
        realUri.putQueryParameter(entry.getKey(), entry.getValue());
      }
      realUri.removeQueryParameter(CALLBACK_STATE_PARAM);
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthCallbackState

    this.stateCrypter = stateCrypter;
  }

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    OAuthCallbackState callbackState = new OAuthCallbackState(stateCrypter,
        req.getParameter(CALLBACK_STATE_PARAM));
    if (callbackState.getRealCallbackUrl() != null) {
      // Copy the query parameters from this URL over to the real URL.
      UriBuilder realUri = UriBuilder.parse(callbackState.getRealCallbackUrl());
      Map<String, List<String>> params = UriBuilder.splitParameters(req.getQueryString());
      for (Map.Entry<String, List<String>> entry : params.entrySet()) {
        realUri.putQueryParameter(entry.getKey(), entry.getValue());
      }
      realUri.removeQueryParameter(CALLBACK_STATE_PARAM);
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.OAuthCallbackState

    this.stateCrypter = stateCrypter;
  }

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    OAuthCallbackState callbackState = new OAuthCallbackState(stateCrypter,
        req.getParameter(CALLBACK_STATE_PARAM));
    if (callbackState.getRealCallbackUrl() != null) {
      // Copy the query parameters from this URL over to the real URL.
      UriBuilder realUri = UriBuilder.parse(callbackState.getRealCallbackUrl());
      Map<String, List<String>> params = UriBuilder.splitParameters(req.getQueryString());
      for (Map.Entry<String, List<String>> entry : params.entrySet()) {
        realUri.putQueryParameter(entry.getKey(), entry.getValue());
      }
      realUri.removeQueryParameter(CALLBACK_STATE_PARAM);
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.