Package org.apache.shindig.gadgets.oauth2

Examples of org.apache.shindig.gadgets.oauth2.OAuth2CallbackState


  }

  @Test(expected = OAuth2RequestException.class)
  public void testGetCompleteUrl_1() throws Exception {
    final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth;
    final OAuth2Accessor accessor = null;
    fixture.getCompleteUrl(accessor);
  }
View Full Code Here


  }

  @Test(expected = OAuth2RequestException.class)
  public void testGetCompleteUrl_2() throws Exception {
    final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Error();
    fixture.getCompleteUrl(accessor);
  }
View Full Code Here

  }

  @Test(expected = OAuth2RequestException.class)
  public void testGetCompleteUrl_3() throws Exception {
    final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_ClientCredentialsRedirecting();
    fixture.getCompleteUrl(accessor);
  }
View Full Code Here

  }

  @Test
  public void testGetCompleteUrl_4() throws Exception {
    final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code();
    final String result = fixture.getCompleteUrl(accessor);

    Assert.assertNotNull(result);
    Assert.assertEquals(
            "http://www.example.com/authorize?client_id=clientId1&redirect_uri=https%3A%2F%2Fwww.example.com%2Fgadgets%2Foauth2callback&response_type=code&scope=testScope&state=574006657",
View Full Code Here

  }

  @Test
  public void testGetCompleteUrl_5() throws Exception {
    final CodeGrantTypeHandler fixture = CodeGrantTypeHandlerTest.cgth;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code();
    Map<String, String> additionalParams = Maps.newHashMap();
    additionalParams.put("param1", "value1");
    accessor.setAdditionalRequestParams(additionalParams);
    final String result = fixture.getCompleteUrl(accessor);

    Assert.assertNotNull(result);
    Assert.assertTrue(result.contains("&param1=value1"));
  }
View Full Code Here

  }

  @Test
  public void testHandleRequest_1() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Redirecting();
    final HttpServletRequest request = null;

    final OAuth2HandlerError result = fixture.handleRequest(accessor, request);

    Assert.assertNotNull(result);
View Full Code Here

  }

  @Test
  public void testHandleRequest_2() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = null;
    final HttpServletRequest request = new DummyHttpServletRequest();

    final OAuth2HandlerError result = fixture.handleRequest(accessor, request);

    Assert.assertNotNull(result);
View Full Code Here

  }

  @Test
  public void testHandleRequest_3() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Error();
    final HttpServletRequest request = new DummyHttpServletRequest();

    final OAuth2HandlerError result = fixture.handleRequest(accessor, request);

    Assert.assertNotNull(result);
View Full Code Here

  }

  @Test
  public void testHandleRequest_4() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_ClientCredentialsRedirecting();
    final HttpServletRequest request = new DummyHttpServletRequest();

    final OAuth2HandlerError result = fixture.handleRequest(accessor, request);

    Assert.assertNotNull(result);
View Full Code Here

  }

  @Test
  public void testHandleRequest_5() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Redirecting();
    final HttpServletRequest request = new DummyHttpServletRequest();

    final OAuth2HandlerError result = fixture.handleRequest(accessor, request);

    Assert.assertNull(result);

    final OAuth2Token accessToken = CodeAuthorizationResponseHandlerTest.store.getToken(
        accessor.getGadgetUri(), accessor.getServiceName(), accessor.getUser(),
        accessor.getScope(), OAuth2Token.Type.ACCESS);
    Assert.assertNotNull(accessToken);
    Assert.assertEquals("xxx", new String(accessToken.getSecret(), "UTF-8"));
    Assert.assertEquals(OAuth2Message.BEARER_TOKEN_TYPE, accessToken.getTokenType());
    Assert.assertTrue(accessToken.getExpiresAt() > 1000);

    final OAuth2Token refreshToken = CodeAuthorizationResponseHandlerTest.store.getToken(
        accessor.getGadgetUri(), accessor.getServiceName(), accessor.getUser(),
        accessor.getScope(), OAuth2Token.Type.REFRESH);
    Assert.assertNotNull(refreshToken);
    Assert.assertEquals("yyy", new String(refreshToken.getSecret(), "UTF-8"));
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.oauth2.OAuth2CallbackState

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.