Package net.oauth

Examples of net.oauth.OAuthServiceProvider


  private OAuthServiceImpl oauthService;

  private OAuthAccessor buildAccessor(String consumerKey,
    String consumerSecret, String requestTokenUrl, String authorizeUrl,
    String callbackUrl, String accessTokenUrl) {
    OAuthServiceProvider provider =
      new OAuthServiceProvider(requestTokenUrl, authorizeUrl, accessTokenUrl);
    OAuthConsumer consumer =
      new OAuthConsumer(callbackUrl, consumerKey, consumerSecret, provider);
    OAuthAccessor accessor = new OAuthAccessor(consumer);
    return accessor;
  }
View Full Code Here


    @RequestMapping("/handleTemporaryCredentials")
    public ModelAndView handleRequest(@ModelAttribute(value = "oAuthParams") OAuthParams oAuthParams,
                                      HttpServletResponse response) {

        OAuthServiceProvider provider;
        OAuthConsumer consumer;
        OAuthAccessor accessor;

        OAuthClient client = new OAuthClient(new URLConnectionClient());

        oAuthParams.setErrorMessage(null);
        String temporaryCredentialsEndpointUrl = oAuthParams.getTemporaryCredentialsEndpoint();
        if (temporaryCredentialsEndpointUrl == null || "".equals(temporaryCredentialsEndpointUrl)) {
            oAuthParams.setErrorMessage("Missing temporary credentials endpoint url");
        }
        String clientId = oAuthParams.getClientID();
        if (clientId == null || "".equals(clientId)) {
            oAuthParams.setErrorMessage("Missing client identifier");
        }
        String secret = oAuthParams.getClientSecret();
        if (secret == null || "".equals(secret)) {
            oAuthParams.setErrorMessage("Missing client shared-secret");
        }

        if (oAuthParams.getErrorMessage() == null) {
            provider = new OAuthServiceProvider(temporaryCredentialsEndpointUrl,
                oAuthParams.getResourceOwnerAuthorizationEndpoint(), oAuthParams.getTokenRequestEndpoint());
            consumer = new OAuthConsumer(null, clientId,
                secret,
                provider);
            accessor = new OAuthAccessor(consumer);
View Full Code Here

    return new Token(accessor.requestToken, accessor.tokenSecret);
  }

  private OAuthAccessor getOAuthAccessor() {
    OAuthServiceProvider serviceProvider = new OAuthServiceProvider(
        provider.getRequestTokenUrl(), provider.getAuthorizeUrl(),
        provider.getAccessTokenUrl());

    OAuthConsumer consumer = new OAuthConsumer(null, consumerKey,
        consumerSecret, serviceProvider);
View Full Code Here

        OAuthConsumerStore consumerStore = new OAuthConsumerStoreImpl();
        consumerStore.setGadgetUri(GADGET_URI);
        consumerStore.setConsumerKey("gadgetConsumer");
        consumerStore.setConsumerSecret(CONSUMER_SECRET);
        consumerStore.setKeyType(OAuthConsumerStore.KeyType.HMAC_SYMMETRIC);
        OAuthServiceProvider provider = new OAuthServiceProvider(null, null, null);

        expect(consumerStoreService.findByUriAndServiceName(GADGET_URI, SERVICE_NAME))
                .andReturn(consumerStore);
        replay(consumerStoreService);
View Full Code Here

  private int trustedParamCount;

  public FakeOAuthServiceProvider(TimeSource clock) {
    this.clock = clock;
    OAuthServiceProvider provider = new OAuthServiceProvider(
        REQUEST_TOKEN_URL, APPROVAL_URL, ACCESS_TOKEN_URL);

    signedFetchConsumer = new OAuthConsumer(null, null, null, null);
    signedFetchConsumer.setProperty(RSA_SHA1.X509_CERTIFICATE, CERTIFICATE_TEXT);
View Full Code Here

  @Test
  public void testInit() throws Exception {
    FakeGadgetToken t = new FakeGadgetToken();
    t.setAppUrl("http://localhost:8080/samplecontainer/examples/oauth.xml");
    OAuthServiceProvider provider = new OAuthServiceProvider("req", "authorize", "access");
    ConsumerInfo consumerInfo = store.getConsumerKeyAndSecret(t, "", provider);
    OAuthConsumer consumer = consumerInfo.getConsumer();
    assertEquals("gadgetConsumer", consumer.consumerKey);
    assertEquals("gadgetSecret", consumer.consumerSecret);
    assertEquals("HMAC-SHA1", consumer.getProperty("oauth_signature_method"));
View Full Code Here

  @Test
  public void testDefaultKey() throws Exception {
    FakeGadgetToken t = new FakeGadgetToken();
    t.setAppUrl("http://localhost:8080/not-in-store.xml");
    OAuthServiceProvider provider = new OAuthServiceProvider("req", "authorize", "access");

    try {
      store.getConsumerKeyAndSecret(t, "", provider);
      fail();
    } catch (GadgetException e) {
View Full Code Here

    store = new BasicOAuthStore();
    store.initFromConfigString(SAMPLE_FILE);
   
    FakeGadgetToken t = new FakeGadgetToken();
    t.setAppUrl("http://localhost:8080/samplecontainer/examples/oauth.xml");
    OAuthServiceProvider provider = new OAuthServiceProvider("req", "authorize", "access");
    ConsumerInfo consumerInfo = store.getConsumerKeyAndSecret(t, "", provider);
    OAuthConsumer consumer = consumerInfo.getConsumer();
    assertEquals("gadgetConsumer", consumer.consumerKey);
    assertNull(consumerInfo.getKeyName());
    assertNull(consumerInfo.getCallbackUrl());
View Full Code Here

  private final OAuthServiceProvider SERVICE_PROVIDER;

  @Inject
  public SampleOAuthDataStore(JsonDbOpensocialService dbService, @Named("shindig.oauth.base-url") String baseUrl) {
    this.service = dbService;
    this.SERVICE_PROVIDER = new OAuthServiceProvider(baseUrl + "/requestToken", baseUrl + "/authorize", baseUrl + "/accessToken");
  }
View Full Code Here

  private SecurityToken expectedRequestSecurityToken;

  public FakeOAuthServiceProvider(TimeSource clock) {
    this.clock = clock;
    OAuthServiceProvider provider = new OAuthServiceProvider(
        REQUEST_TOKEN_URL, APPROVAL_URL, ACCESS_TOKEN_URL);

    signedFetchConsumer = new OAuthConsumer(null, null, null, null);
    signedFetchConsumer.setProperty(RSA_SHA1.X509_CERTIFICATE, CERTIFICATE_TEXT);
View Full Code Here

TOP

Related Classes of net.oauth.OAuthServiceProvider

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.