Package net.oauth

Examples of net.oauth.OAuthServiceProvider


    // access token requests, but that's probably not useful.  We just use the request token
    // rules for everything.
    accessorBuilder.setParameterLocation(
        getStoreLocation(service.getRequestUrl().location, responseParams));
    accessorBuilder.setMethod(getStoreMethod(service.getRequestUrl().method, responseParams));
    return new OAuthServiceProvider(
        service.getRequestUrl().url.toJavaUri().toASCIIString(),
        service.getAuthorizationUrl().toJavaUri().toASCIIString(),
        service.getAccessUrl().url.toJavaUri().toASCIIString());
  }
View Full Code Here


      String accessTokenUrl = arguments.getRequestOption(OAuthArguments.ACCESS_TOKEN_URL_PARAM);
      verifyUrl(accessTokenUrl, responseParams);

      String authorizationUrl = arguments.getRequestOption(OAuthArguments.AUTHORIZATION_URL_PARAM);
      verifyUrl(authorizationUrl, responseParams);
      return new OAuthServiceProvider(requestTokenUrl, authorizationUrl, accessTokenUrl);
    } catch (SpecParserException e) {
      // these exceptions have decent programmer readable messages
      throw new OAuthRequestException(OAuthError.BAD_OAUTH_CONFIGURATION,
          e.getMessage());
    }
View Full Code Here

    String sharedSecret = sampleContainerSharedSecrets.get(appId);
    if (sharedSecret == null) {
      return false;
    }

    OAuthServiceProvider provider = new OAuthServiceProvider(null, null, null);
    OAuthConsumer consumer = new OAuthConsumer(null, appUrl, sharedSecret, provider);
    OAuthAccessor accessor = new OAuthAccessor(consumer);

    SimpleOAuthValidator validator = new SimpleOAuthValidator();
    try {
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

            oAuthParams.setErrorMessage("Missing oauth verifier");
        }

        if (oAuthParams.getErrorMessage() == null) {
            OAuthClient client = new OAuthClient(new URLConnectionClient());
            OAuthServiceProvider provider = new OAuthServiceProvider(
                oAuthParams.getTemporaryCredentialsEndpoint(),
                oAuthParams.getResourceOwnerAuthorizationEndpoint(), tokenRequestEndpoint);

            OAuthConsumer consumer = new OAuthConsumer(null, clientID,
                oAuthParams.getClientSecret(),
View Full Code Here

    @RequestMapping("/getProtectedResource")
    protected ModelAndView handleRequest(@ModelAttribute("oAuthParams") OAuthParams oAuthParams,
                                         HttpServletRequest request)
        throws Exception {

        OAuthServiceProvider provider = new OAuthServiceProvider(
            oAuthParams.getTemporaryCredentialsEndpoint(),
            oAuthParams.getResourceOwnerAuthorizationEndpoint(), null);

        OAuthConsumer consumer = new OAuthConsumer(null, oAuthParams.getClientID(),
            oAuthParams.getClientSecret(),
View Full Code Here

    AccessorInfoBuilder accessorBuilder = new AccessorInfoBuilder();

    // Does the gadget spec tell us any details about the service provider, like where to put the
    // OAuth parameters and what methods to use for their URLs?
    OAuthServiceProvider provider = null;
    if (arguments.mayUseToken()) {
      provider = lookupSpecInfo(securityToken, arguments, accessorBuilder);
    } else {
      // This is plain old signed fetch.
      accessorBuilder.setParameterLocation(AccessorInfo.OAuthParamLocation.URI_QUERY);
View Full Code Here

    // In theory some one could specify different parameter locations for request token and
    // access token requests, but that's probably not useful.  We just use the request token
    // rules for everything.
    accessorBuilder.setParameterLocation(getStoreLocation(service.getRequestUrl().location));
    accessorBuilder.setMethod(getStoreMethod(service.getRequestUrl().method));
    OAuthServiceProvider provider = new OAuthServiceProvider(
        service.getRequestUrl().url.toJavaUri().toASCIIString(),
        service.getAuthorizationUrl().toJavaUri().toASCIIString(),
        service.getAccessUrl().url.toJavaUri().toASCIIString());
    return provider;
  }
View Full Code Here

     */
    private synchronized RealmOAuthConsumer getConsumer() {
        // could just inject these, but I kinda prefer pushing this out
        // to the properties file...
        if (consumer == null) {
            OAuthServiceProvider serviceProvider = new OAuthServiceProvider("", "", "");
            String realm = propertyResolver.getProperty("org.jasig.rest.interceptor.oauth." + id + ".realm");
            String consumerKey = propertyResolver.getProperty("org.jasig.rest.interceptor.oauth." + id + ".consumerKey");
            String secretKey = propertyResolver.getProperty("org.jasig.rest.interceptor.oauth." + id + ".secretKey");

            Assert.notNull(consumerKey, "The property \"org.jasig.rest.interceptor.oauth." + id + ".consumerKey\" must be set.");
View Full Code Here

    // Pick up any additional information needed about the format of the request, either from
    // options to makeRequest, or options from the spec, or from sensible defaults.  This is how
    // we figure out where to put the OAuth parameters and what methods to use for the OAuth
    // URLs.
    OAuthServiceProvider provider = null;
    if (arguments.programmaticConfig()) {
      provider = loadProgrammaticConfig(arguments, accessorBuilder, responseParams);
    } else if (arguments.mayUseToken()) {
      provider = lookupSpecInfo(securityToken, arguments, accessorBuilder, responseParams);
    } else {
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.