Package org.apache.shindig.common.crypto

Examples of org.apache.shindig.common.crypto.BasicBlobCrypter


  }

  @Test
  public void testOAuthFlow_noSpecInvalidUrl() throws Exception {
    fetcherConfig = new OAuthFetcherConfig(
        new BasicBlobCrypter("abcdefghijklmnop".getBytes()),
        getOAuthStore(base, null),
        clock, null, false);

    MakeRequestClient client = makeNonSocialClient("owner", "owner", GADGET_URL);
    setNoSpecOptions(client);
View Full Code Here


  }

  @Test
  public void testOAuthFlow_noSpecBlankUrl() throws Exception {
    fetcherConfig = new OAuthFetcherConfig(
        new BasicBlobCrypter("abcdefghijklmnop".getBytes()),
        getOAuthStore(base, null),
        clock, null, false);

    MakeRequestClient client = makeNonSocialClient("owner", "owner", GADGET_URL);
    setNoSpecOptions(client);
View Full Code Here

  }

  @Test
  public void testAccessTokenOkForSecureOwnerPage() throws Exception {
    fetcherConfig = new OAuthFetcherConfig(
        new BasicBlobCrypter("abcdefghijklmnop".getBytes()),
        getOAuthStore(base),
        clock,
        callbackGenerator,
        true);
View Full Code Here

   *
   * @param key The security token key.
   * @return The BlobCrypter.
   */
  protected BlobCrypter loadCrypter(String key) {
    return new BasicBlobCrypter(key);
  }
View Full Code Here

  private BlobCrypter crypter;
  private OAuthResponseParams params;

  @Before
  public void setUp() {
    crypter = new BasicBlobCrypter("abcdefafadfaxxxx".getBytes());
    token = EasyMock.createMock(SecurityToken.class);
    origRequest = new HttpRequest(Uri.parse("http://originalrequest/"));
    EasyMock.expect(token.getAppUrl()).andStubReturn(APP);
    EasyMock.replay(token);
    params = new OAuthResponseParams(token, origRequest, crypter);
View Full Code Here

  private FakeTimeSource timeSource;
  private BasicBlobCrypter crypter;

  @Before
  public void setUp() throws Exception {
    crypter = new BasicBlobCrypter("abcdefghijklmnop".getBytes());
    timeSource = new FakeTimeSource();
    crypter.timeSource = timeSource;
  }
View Full Code Here

  public void setUp() throws Exception {
    control = EasyMock.createNiceControl();
    processor = control.createMock(Processor.class);
    lockedDomainService = control.createMock(LockedDomainService.class);
    oauthUriManager = control.createMock(OAuthUriManager.class);
    stateCrypter = new BasicBlobCrypter("1111111111111111111".getBytes());
    securityToken = new BasicSecurityToken("viewer", "viewer", "app", "container.com",
        "gadget", "0", "default", MAKE_REQUEST_URL, null);
    gadget = control.createMock(Gadget.class);
    fetcherConfig = new OAuthFetcherConfig(null, null, null, null, false);
    responseParams = new OAuthResponseParams(null, null, null);
View Full Code Here

      if (StringUtils.isBlank(stateCrypterPath)) {
        LOG.info("Using random key for OAuth client-side state encryption");
        if (LOG.isLoggable(Level.INFO)) {
          LOG.logp(Level.INFO, classname, "OAuthCrypterProvider constructor", MessageKeys.USING_RANDOM_KEY);
        }
        crypter = new BasicBlobCrypter(Crypto.getRandomBytes(BasicBlobCrypter.MASTER_KEY_MIN_LEN));
      } else {
        if (LOG.isLoggable(Level.INFO)) {
          LOG.logp(Level.INFO, classname, "OAuthCrypterProvider constructor", MessageKeys.USING_FILE, new Object[] {stateCrypterPath});
        }
        crypter = new BasicBlobCrypter(new File(stateCrypterPath));
      }
    }
View Full Code Here

    // check we have the required information:
    if (instance.getWidget() == null || instance.getIdKey() == null) {
      throw new Exception(localizedMessages.getString("OpenSocialUtils.1")); //$NON-NLS-1$
    }
   
    BasicBlobCrypter crypter = new BasicBlobCrypter(key.getBytes());
    BlobCrypterSecurityToken token = new BlobCrypterSecurityToken(crypter, CONTAINER_ID, DOMAIN_ID);
    token.setAppUrl(getUrl(instance));
    // The ModuleId only takes a long, so we just have to hash the idKey for now. We could use the instance id,
    // but this would involve updating the instance object in a two-step create, which is more fiddly and expensive.
    token.setModuleId(instance.getIdKey().hashCode());
View Full Code Here

                "Using random key for OAuth2 client-side state encryption", new Object[] {});
        if (OAuth2Module.LOG.isLoggable(Level.INFO)) {
          OAuth2Module.LOG.log(Level.INFO, "OAuth2CrypterProvider constructor",
                  MessageKeys.USING_RANDOM_KEY);
        }
        this.crypter = new BasicBlobCrypter(
                Crypto.getRandomBytes(BasicBlobCrypter.MASTER_KEY_MIN_LEN));
      } else {
        if (OAuth2Module.LOG.isLoggable(Level.INFO)) {
          OAuth2Module.LOG.log(Level.INFO, "OAuth2CrypterProvider constructor",
                  new Object[] { stateCrypterPath });
        }
        this.crypter = new BasicBlobCrypter(new File(stateCrypterPath));
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.shindig.common.crypto.BasicBlobCrypter

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.