Package org.apache.shindig.gadgets.oauth2.handler

Examples of org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError


    return accessToken;
  }

  private static BasicOAuth2Accessor getOAuth2AccessorCommon() throws Exception {
    final OAuth2Cache cache = new InMemoryCache();
    final OAuth2Persister persister = MockUtils.getDummyPersister();
    final OAuth2Store store = MockUtils.getDummyStore(cache, persister, MockUtils.REDIRECT_URI);
    final BasicOAuth2Accessor accessor = new BasicOAuth2Accessor(MockUtils.GADGET_URI1,
        MockUtils.SERVICE_NAME, MockUtils.USER, MockUtils.SCOPE, true, store,
        MockUtils.REDIRECT_URI);
View Full Code Here


    return accessor;
  }

  protected static OAuth2Accessor getOAuth2Accessor_ClientCredentialsRedirecting() throws Exception {
    final OAuth2Cache cache = new InMemoryCache();
    final OAuth2Persister persister = MockUtils.getDummyPersister();
    final OAuth2Store store = MockUtils.getDummyStore(cache, persister, MockUtils.REDIRECT_URI);
    final BasicOAuth2Accessor accessor = new BasicOAuth2Accessor(MockUtils.GADGET_URI1,
        MockUtils.SERVICE_NAME, MockUtils.USER, MockUtils.SCOPE, true, store,
        MockUtils.REDIRECT_URI);
View Full Code Here

    token.setTokenType(OAuth2Message.BEARER_TOKEN_TYPE);
    token.setUser(MockUtils.USER);
  }

  protected static OAuth2TokenPersistence getAccessToken() throws Exception {
    final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence(
        MockUtils.getDummyEncrypter());
    MockUtils.setTokenCommons(accessToken);
    accessToken.setType(OAuth2Token.Type.ACCESS);
    return accessToken;
  }
View Full Code Here

    accessToken.setType(OAuth2Token.Type.ACCESS);
    return accessToken;
  }

  protected static OAuth2TokenPersistence getBadMacToken() throws Exception {
    final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence(
        MockUtils.getDummyEncrypter());
    MockUtils.setTokenCommons(accessToken);
    accessToken.setMacAlgorithm(OAuth2Message.HMAC_SHA_256);
    accessToken.setMacExt("1 2 3");
    accessToken.setMacSecret(MockUtils.MAC_SECRET.getBytes("UTF-8"));
    accessToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE);
    accessToken.setType(OAuth2Token.Type.ACCESS);
    return accessToken;
  }
View Full Code Here

  protected static String getJSONString() throws IOException {
    return MockUtils.loadFile("org/apache/shindig/gadgets/oauth2/oauth2_test.json");
  }

  protected static OAuth2TokenPersistence getMacToken() throws Exception {
    final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence(
        MockUtils.getDummyEncrypter());

    MockUtils.setTokenCommons(accessToken);
    accessToken.setMacAlgorithm(OAuth2Message.HMAC_SHA_1);
    accessToken.setMacExt("1 2 3");
    accessToken.setMacSecret(MockUtils.MAC_SECRET.getBytes("UTF-8"));
    accessToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE);
    accessToken.setType(OAuth2Token.Type.ACCESS);

    return accessToken;
  }
View Full Code Here

    return accessor;
  }

  protected static OAuth2TokenPersistence getRefreshToken() throws Exception {
    final OAuth2TokenPersistence refreshToken = new OAuth2TokenPersistence(
        MockUtils.getDummyEncrypter());
    refreshToken.setExpiresAt(1L);
    refreshToken.setGadgetUri(MockUtils.GADGET_URI1);
    refreshToken.setIssuedAt(0L);
    refreshToken.setMacAlgorithm("");
    refreshToken.setMacExt("");
    refreshToken.setMacSecret(new byte[] {});
    refreshToken.setProperties(MockUtils.EMPTY_MAP);
    refreshToken.setScope(MockUtils.SCOPE);
    refreshToken.setSecret(MockUtils.ACCESS_SECRET.getBytes("UTF-8"));
    refreshToken.setServiceName(MockUtils.SERVICE_NAME);
    refreshToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE);
    refreshToken.setType(OAuth2Token.Type.REFRESH);
    refreshToken.setUser(MockUtils.USER);
    return refreshToken;
  }
View Full Code Here

    return new DummySecurityToken(ownerId, viewerId, appUrl);
  }

  protected static OAuth2Store getDummyStore() throws Exception {
    if (MockUtils.dummyStore == null) {
      final OAuth2Cache cache = new InMemoryCache();
      final OAuth2Persister persister = MockUtils.getDummyPersister();
      MockUtils.dummyStore = MockUtils.getDummyStore(cache, persister, MockUtils.REDIRECT_URI);
    }

    MockUtils.dummyStore.clearCache();
View Full Code Here

    return accessToken;
  }

  private static BasicOAuth2Accessor getOAuth2AccessorCommon() throws Exception {
    final OAuth2Cache cache = new InMemoryCache();
    final OAuth2Persister persister = MockUtils.getDummyPersister();
    final OAuth2Store store = MockUtils.getDummyStore(cache, persister, MockUtils.REDIRECT_URI);
    final BasicOAuth2Accessor accessor = new BasicOAuth2Accessor(MockUtils.GADGET_URI1,
        MockUtils.SERVICE_NAME, MockUtils.USER, MockUtils.SCOPE, true, store,
        MockUtils.REDIRECT_URI);
View Full Code Here

    return accessor;
  }

  protected static OAuth2Accessor getOAuth2Accessor_ClientCredentialsRedirecting() throws Exception {
    final OAuth2Cache cache = new InMemoryCache();
    final OAuth2Persister persister = MockUtils.getDummyPersister();
    final OAuth2Store store = MockUtils.getDummyStore(cache, persister, MockUtils.REDIRECT_URI);
    final BasicOAuth2Accessor accessor = new BasicOAuth2Accessor(MockUtils.GADGET_URI1,
        MockUtils.SERVICE_NAME, MockUtils.USER, MockUtils.SCOPE, true, store,
        MockUtils.REDIRECT_URI);
View Full Code Here

    return new DummyMessageProvider();
  }

  protected static JSONOAuth2Persister getDummyPersister() throws Exception {
    final JSONObject configFile = new JSONObject(MockUtils.getJSONString());
    return new JSONOAuth2Persister(MockUtils.getDummyEncrypter(), MockUtils.getDummyAuthority(),
        MockUtils.REDIRECT_URI, "xxx", configFile);
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError

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.