Package org.apache.shindig.auth

Examples of org.apache.shindig.auth.SecurityTokenException


  @Test
  public void testTokenMultipleGadgetsWithSuccessAndFailure() throws Exception {
    SecurityTokenCodec codec = EasyMock.createMock(SecurityTokenCodec.class);
    EasyMock.expect(codec.encodeToken(EasyMock.isA(SecurityToken.class))).andReturn(TOKEN);
    EasyMock.expect(codec.encodeToken(EasyMock.isA(SecurityToken.class))).andThrow(
            new SecurityTokenException("blah"));
    replay(codec);

    registerGadgetsHandler(codec);
    JSONObject request = makeTokenRequest(GADGET1_URL, GADGET2_URL);
View Full Code Here


  @Test(expected = SecurityTokenException.class)
  public void testGetTokenException() throws Exception {
    GadgetsHandlerApi.TokenRequest request = createTokenRequest(FakeProcessor.SPEC_URL, CONTAINER,
            createAuthContext(OWNER, VIEWER), ImmutableList.of("*"));
    replay();
    tokenCodec.exc = new SecurityTokenException("bad data");
    gadgetHandler.getToken(request);
  }
View Full Code Here

  @Test
  public void testTokenOneGadgetFailure() throws Exception {
    SecurityTokenCodec codec = EasyMock.createMock(SecurityTokenCodec.class);
    EasyMock.expect(codec.encodeToken(EasyMock.isA(SecurityToken.class))).andThrow(
            new SecurityTokenException("blah"));
    replay(codec);

    registerGadgetsHandler(codec);
    JSONObject request = makeTokenRequest(GADGET1_URL);
    RpcHandler operation = registry.getRpcHandler(request);
View Full Code Here

  @Test
  public void testTokenMultipleGadgetsWithSuccessAndFailure() throws Exception {
    SecurityTokenCodec codec = EasyMock.createMock(SecurityTokenCodec.class);
    EasyMock.expect(codec.encodeToken(EasyMock.isA(SecurityToken.class))).andReturn(TOKEN);
    EasyMock.expect(codec.encodeToken(EasyMock.isA(SecurityToken.class))).andThrow(
            new SecurityTokenException("blah"));
    replay(codec);

    registerGadgetsHandler(codec);
    JSONObject request = makeTokenRequest(GADGET1_URL, GADGET2_URL);
View Full Code Here

  @Test(expected = SecurityTokenException.class)
  public void testGetTokenException() throws Exception {
    GadgetsHandlerApi.TokenRequest request = createTokenRequest(FakeProcessor.SPEC_URL, CONTAINER,
            createAuthContext(OWNER, VIEWER), ImmutableList.of("*"));
    replay();
    tokenCodec.exc = new SecurityTokenException("bad data");
    gadgetHandler.getToken(request);
  }
View Full Code Here

  public void testGetTokenException() throws Exception {
    GadgetsHandlerApi.TokenRequest request = createTokenRequest(
        FakeProcessor.SPEC_URL, CONTAINER,
        createTokenData(OWNER, VIEWER), ImmutableList.of("*"));
    replay();
    tokenCodec.exc = new SecurityTokenException("bad data");
    GadgetsHandlerApi.TokenResponse response = gadgetHandler.getToken(request);
  }
View Full Code Here

    expect(fetcher.fetch(isA(HttpRequest.class))).andReturn(appTokenResponse)
    expect(appTokenResponse.getResponse()).andReturn(new ByteArrayInputStream("access_token=appToken123".getBytes("UTF-8")));
    expect(fetcher.fetch(isA(HttpRequest.class))).andReturn(inspectResponse)
    expect(inspectResponse.getResponse()).andReturn(new ByteArrayInputStream("{data: {is_valid: true, user_id: userId123} }".getBytes("UTF-8")));

    expect(codec.encodeToken(isA(LoginSecurityToken.class))).andThrow(new SecurityTokenException("Bad Security Token"));
    resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Error generating security token.");
    expectLastCall();
   
    replay(accessTokenResponse);
    replay(appTokenResponse);
View Full Code Here

    replay(codec);
    this.contrib = new OSEAuthConfigContributor(codec);

    SecurityTokenCodec exceptionCodec = createNiceMock(SecurityTokenCodec.class);
    expect(exceptionCodec.encodeToken(anyObject(SecurityToken.class))).andThrow(
            new SecurityTokenException("Catch me!")).anyTimes();
    replay(exceptionCodec);
    this.exceptionContrib = new OSEAuthConfigContributor(exceptionCodec);
  }
View Full Code Here

    expect(mockIdToken.getPayload()).andReturn(mockPayload);
    expect(mockPayload.getSubject()).andReturn("userId123");
    expect(mockPayload.getIssuer()).andReturn("accounts.google.com");
    expect(mockPayload.getAudience()).andReturn("clientId");
   
    expect(codec.encodeToken(isA(LoginSecurityToken.class))).andThrow(new SecurityTokenException("Bad Security Token"));
    resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Error generating security token.");
    expectLastCall();
   
    PowerMock.replay(googleResponse);
    replay(fetcher);
View Full Code Here

TOP

Related Classes of org.apache.shindig.auth.SecurityTokenException

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.