Examples of AccessGrant


Examples of org.encuestame.utils.oauth.AccessGrant

    public String oauth2Callback(
            @RequestParam(value = "code", required = true) String code,
            HttpServletRequest httpRequest,
            WebRequest request) throws Exception {
        try {
             final AccessGrant accessGrant = auth2RequestProvider.getAccessGrant(code, httpRequest);
             log.debug(accessGrant.getAccessToken());
             log.debug(accessGrant.getRefreshToken());
             checkOAuth2SocialAccount(SocialProvider.FACEBOOK, accessGrant);
        } catch (EnMeOAuthSecurityException e1) {
            RequestSessionMap.setErrorMessage(getMessage("errorOauth", httpRequest, null));
        } catch (EnMeExistPreviousConnectionException e1) {
            RequestSessionMap.setErrorMessage(getMessage("social.repeated.account", httpRequest, null));
View Full Code Here

Examples of org.encuestame.utils.oauth.AccessGrant

           HttpServletRequest httpRequest,
           WebRequest request) {
        try {
                  log.debug("httpRequest "+httpRequest.getRequestURI());
                  log.debug("httpRequest "+httpRequest.getQueryString());
               final AccessGrant accessGrant = auth2RequestProvider.getAccessGrant(code, httpRequest);
               if (log.isDebugEnabled()) {
                   log.debug(accessGrant.getAccessToken());
                   log.debug(accessGrant.getRefreshToken());
               }
            String friendsUrl = "redirect:/user/signin/friends";
            final SocialProvider providerBack;
            if ("google".equals(provider) && state != null) {
                providerBack = SocialProvider.getProvider(state);
View Full Code Here

Examples of org.springframework.social.oauth2.AccessGrant

    @PermitAll
    @Path("login/{providerId}")
    @POST
    public Response socialLogin(@PathParam("providerId") String providerId, OAuth2Request request) {
        OAuth2ConnectionFactory<?> connectionFactory = (OAuth2ConnectionFactory<?>) connectionFactoryLocator.getConnectionFactory(providerId);
        Connection<?> connection = connectionFactory.createConnection(new AccessGrant(request.getAccessToken()));
        AuthenticatedUserToken token = userService.socialLogin(connection);
        return getLoginResponse(token);
    }
View Full Code Here

Examples of org.springframework.social.oauth2.AccessGrant

    try {
      response2 = mapper.readValue(jsonString, Map.class);
    } catch (Exception e) {
     
    }
        return new AccessGrant(response2.get("access_token"), null, null, null);
    }
View Full Code Here

Examples of org.springframework.social.oauth2.AccessGrant

      verifyStateParameter(request);
    }
   
    String code = request.getParameter("code");
    try {
      AccessGrant accessGrant = connectionFactory.getOAuthOperations().exchangeForAccess(code, callbackUrl(request), null);
      return connectionFactory.createConnection(accessGrant);
    } catch (HttpClientErrorException e) {
      logger.warn("HttpClientErrorException while completing connection: " + e.getMessage());
      logger.warn("      Response body: " + e.getResponseBodyAsString());
      throw e;
View Full Code Here

Examples of org.springframework.social.oauth2.AccessGrant

    }
  }

  public void refresh() {
    synchronized (getMonitor()) {
      AccessGrant accessGrant = serviceProvider.getOAuthOperations().refreshAccess(refreshToken, null);
      initAccessTokens(accessGrant.getAccessToken(), accessGrant.getRefreshToken(), accessGrant.getExpireTime());
      initApi();
    }
  }
View Full Code Here

Examples of org.springframework.social.oauth2.AccessGrant

  public AccessGrant exchangeForAccess(String authorizationCode, String redirectUri, MultiValueMap<String, String> additionalParameters) {
    if (behavior == THROW_EXCEPTION) {
      throw new HttpClientErrorException(BAD_REQUEST);
    }
   
    return new AccessGrant("accessToken");
  }
View Full Code Here

Examples of org.springframework.social.oauth2.AccessGrant

  public void test() throws Exception {
    @SuppressWarnings("unchecked")
    final OAuth2ConnectionFactory<Object> factory = mock(OAuth2ConnectionFactory.class);
    final OAuth2Operations operations = mock(OAuth2Operations.class);
    final String serverName = "example.com";
    final AccessGrant accessGrant = new AccessGrant("my_token");
    final String code = "code";
    final Connection<Object> connection = DummyConnection.dummy("provider", "user");

    final OAuth2AuthenticationService<Object> authSvc = new OAuth2AuthenticationService<Object>(factory);
    authSvc.getReturnToUrlParameters().add("param");
View Full Code Here

Examples of org.springframework.social.oauth2.AccessGrant

        }
        public AccessGrant exchangeForAccess(String authorizationGrant, String redirectUri, MultiValueMap<String, String> additionalParameters) {
          assertEquals("authorization-grant", authorizationGrant);
          assertEquals("http://somesite.com/connect/someprovider", redirectUri);
          assertNull(additionalParameters);
          return new AccessGrant("access-token");
        }
        public AccessGrant exchangeCredentialsForAccess(String username, String password, MultiValueMap<String, String> additionalParameters) {
          return null;
        }       
        @Deprecated
View Full Code Here

Examples of org.springframework.social.oauth2.AccessGrant

  public String buildAuthenticateUrl(OAuth2Parameters parameters) {
    return buildAuthorizeUrl(parameters);
  }

  public AccessGrant exchangeForAccess(String authorizationGrant, String redirectUri, MultiValueMap<String, String> additionalParameters) {
    return new AccessGrant("12345", null, "23456", 3600L);
  }
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.