Examples of BasicBlobCrypter


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

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

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

    Assert.assertNotSame("body is " + body, body.indexOf("window.close()"), -1);
  }
 
  @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());
View Full Code Here

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

    assertEquals("private,max-age=3600", cacheControl);
  }
 
  @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());
View Full Code Here

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

      return createToken(gadgetURL, viewer, rUser, moduleId, "default");
   }

   private BlobCrypter getBlobCrypter(String fileName) throws IOException
   {
      BasicBlobCrypter c = new BasicBlobCrypter(new File(fileName));
      c.timeSource = timeSource;
      return c;
   }
View Full Code Here

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

        this.container = container;
        this.domain = domain;

        if (encryptionKey.startsWith(EMBEDDED_KEY_PREFIX)) {
            byte[] key = CharsetUtil.getUtf8Bytes(encryptionKey.substring(EMBEDDED_KEY_PREFIX.length()));
            this.blobCrypter = new BasicBlobCrypter(key);
        } else if (encryptionKey.startsWith(CLASSPATH_KEY_PREFIX)) {
            try {
                File file = new ClassPathResource(encryptionKey.substring(CLASSPATH_KEY_PREFIX.length())).getFile();
                this.blobCrypter = new BasicBlobCrypter(file);
            } catch (IOException e) {
                throw new SecurityException("Unable to load encryption key from classpath resource: " + encryptionKey);
            }
        } else {
            try {
                this.blobCrypter = new BasicBlobCrypter(new File(encryptionKey));
            } catch (IOException e) {
                throw new SecurityException("Unable to load encryption key from file: " + encryptionKey);
            }
        }
    }
View Full Code Here

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

  /**
   * Load a BlobCrypter from the specified file.  Override this if you have your own
   * BlobCrypter implementation.
   */
  protected BlobCrypter loadCrypterFromFile(File file) throws IOException {
    return new BasicBlobCrypter(file);
  }
View Full Code Here

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

        @Inject
        public OAuthCrypterProvider(@Named("shindig.signing.state-key") String stateCrypterPath)
                throws IOException {
            if (StringUtils.isBlank(stateCrypterPath)) {
                logger.info("Using random key for OAuth client-side state encryption");
                crypter = new BasicBlobCrypter(Crypto.getRandomBytes(BasicBlobCrypter.MASTER_KEY_MIN_LEN));
            } else {
                logger.info("Using file " + stateCrypterPath + " for OAuth client-side state encryption");
                crypter = new BasicBlobCrypter(new File(stateCrypterPath));
            }
        }
View Full Code Here

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

  private FakeTimeSource timeSource = new FakeTimeSource();
  private BasicBlobCrypter crypter;

  @Before
  public void setUp() {
    crypter = new BasicBlobCrypter(Crypto.getRandomBytes(20));
    crypter.timeSource = timeSource;
  }
View Full Code Here

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

  protected String getContainerKey(String container) {
    return "KEY FOR CONTAINER " + container;
  }

  protected BlobCrypter getBlobCrypter(String fileName) {
    BasicBlobCrypter c = new BasicBlobCrypter(CharsetUtil.getUtf8Bytes(fileName));
    c.timeSource = timeSource;
    return c;
  }
View Full Code Here

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

  public void setUp() throws Exception {
    control = EasyMock.createNiceControl();
    processor = control.createMock(Processor.class);
    lockedDomainService = control.createMock(LockedDomainService.class);
    urlGenerator = control.createMock(UrlGenerator.class);
    stateCrypter = new BasicBlobCrypter("1111111111111111111".getBytes());
    securityToken = new BasicSecurityToken("viewer", "viewer", "app", "container.com",
        "gadget", "0", "default", MAKE_REQUEST_URL);
    gadget = control.createMock(Gadget.class);
    fetcherConfig = new OAuthFetcherConfig(null, null, null, null, false);
    responseParams = new OAuthResponseParams(null, null, null);
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.