Examples of AnonymousSecurityToken


Examples of org.apache.shindig.auth.AnonymousSecurityToken

      return null;
    }
    try {
      if (normalizedReq.getAccessToken() != null) {
        store.validateRequestForResource(normalizedReq, null);
        return new AnonymousSecurityToken(); // Return your valid security token
      }
    } catch (OAuth2Exception oae) {
      // TODO (Eric): process OAuth2Exception properly
      throw new InvalidAuthenticationException("Something went wrong: ", oae);
    }
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

      this.parsedXmlCache = cacheProvider.createCache(PARSED_XML_CACHE);
    }
  }

  public TemplateLibrary loadTemplateLibrary(GadgetContext context, Uri uri) throws GadgetException {
    HttpRequest request = new HttpRequest(uri).setSecurityToken( new AnonymousSecurityToken( "", 0L, context.getUrl().toString(), 0L ));
    // 5 minute TTL.
    request.setCacheTtl(300);
    HttpResponse response = pipeline.execute(request);
    if (response.getHttpStatusCode() != HttpResponse.SC_OK) {
      int retcode = response.getHttpStatusCode();
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

    assertEquals("2.3.4.5", context.getUserIp());
  }

  @Test
  public void testGetSecurityToken() throws Exception {
    SecurityToken expected = new AnonymousSecurityToken();
    expect(request.getAttribute(AuthInfoUtil.Attribute.SECURITY_TOKEN.getId())).andReturn(expected);
    replay();
    GadgetContext context = new HttpGadgetContext(request);
    assertEquals(expected, context.getToken());
  }
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

  }

  /** {@inheritDoc} */
  public void contribute(Map<String,Object> config, String container, String host) {
    // Inject an anonymous security token TODO set TTL based on cachability of this JS?
    SecurityToken containerToken = new AnonymousSecurityToken(container, 0L,"*", null);
    Map<String, String> authConfig = Maps.newHashMapWithExpectedSize(2);

    try {
      config.put("shindig.auth", authConfig);
      authConfig.put("authToken", securityTokenCodec.encodeToken(containerToken));
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

    }

    if (refershTokenUrl != null) {
      HttpResponse response = null;
      final HttpRequest request = new HttpRequest(Uri.parse(refershTokenUrl));
      request.setSecurityToken(new AnonymousSecurityToken("", 0L, accessor.getGadgetUri()));
      request.setMethod("POST");
      request.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");

      for (final ClientAuthenticationHandler clientAuthenticationHandler : this.clientAuthenticationHandlers) {
        if (clientAuthenticationHandler.geClientAuthenticationType().equalsIgnoreCase(
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

    try {
      EasyMock.expect(
          mockStore.getSecurityTokenForConsumerRequest(
              EasyMock.eq(FakeOAuthRequest.CONSUMER_KEY),
              EasyMock.eq(FakeOAuthRequest.REQUESTOR))).andReturn(
          new AnonymousSecurityToken());
    } catch (OAuthProblemException e) {
      // ignore
    }
  }
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

    }

    final HttpRequest request = new HttpRequest(Uri.parse(completeAuthorizationUrl));
    request.setMethod("GET");
    request.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
    request.setSecurityToken( new AnonymousSecurityToken( "", 0L, accessor.getGadgetUri(), 0L ));

    for (final ClientAuthenticationHandler clientAuthenticationHandler : this.clientAuthenticationHandlers) {
      if (clientAuthenticationHandler.geClientAuthenticationType().equalsIgnoreCase(
              accessor.getClientAuthenticationType())) {
        final OAuth2HandlerError error = clientAuthenticationHandler.addOAuth2Authentication(
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

            .getTokenUrl());

    final HttpRequest request = new HttpRequest(Uri.parse(tokenUrl));
    request.setMethod("POST");
    request.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
    request.setSecurityToken(new AnonymousSecurityToken("", 0L, accessor.getGadgetUri(), 0L));

    if (!isUriAllowed(request.getUri(), accessor.getAllowedDomains())) {
      ret = new OAuth2HandlerError(OAuth2Error.AUTHORIZATION_CODE_PROBLEM,
              "Exception exchanging authorization code for access_token - domain not allowed", null);
    }
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

    request.setMethod(accessorInfo.getHttpMethod().toString());
    if (accessorInfo.getHttpMethod() == HttpMethod.POST) {
      request.setHeader("Content-Type", OAuth.FORM_ENCODED);
    }

    request.setSecurityToken( new AnonymousSecurityToken( "", 0L, this.realRequest.getSecurityToken().getAppUrl(), 0L));
    return request;
  }
View Full Code Here

Examples of org.apache.shindig.auth.AnonymousSecurityToken

      throw new OAuthRequestException(OAuthError.BAD_OAUTH_TOKEN_URL, "access token");
    }
    Uri accessTokenUri = Uri.parse(accessor.consumer.serviceProvider.accessTokenURL);
    HttpRequest request = new HttpRequest(accessTokenUri);
    request.setMethod(accessorInfo.getHttpMethod().toString());
    request.setSecurityToken( new AnonymousSecurityToken( "", 0L, this.realRequest.getSecurityToken().getAppUrl(), 0L));
    if (accessorInfo.getHttpMethod() == HttpMethod.POST) {
      request.setHeader("Content-Type", OAuth.FORM_ENCODED);
    }

    List<Parameter> msgParams = Lists.newArrayList();
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.