Package org.springframework.social.connect

Examples of org.springframework.social.connect.DuplicateConnectionException


      ConnectionData data = connection.createData();
      int rank = jdbcTemplate.queryForObject("select coalesce(max(rank) + 1, 1) as rank from " + tablePrefix + "UserConnection where userId = ? and providerId = ?", new Object[]{ userId, data.getProviderId() }, Integer.class);
      jdbcTemplate.update("insert into " + tablePrefix + "UserConnection (userId, providerId, providerUserId, rank, displayName, profileUrl, imageUrl, accessToken, secret, refreshToken, expireTime) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
          userId, data.getProviderId(), data.getProviderUserId(), rank, data.getDisplayName(), data.getProfileUrl(), data.getImageUrl(), encrypt(data.getAccessToken()), encrypt(data.getSecret()), encrypt(data.getRefreshToken()), data.getExpireTime());
    } catch (DuplicateKeyException e) {
      throw new DuplicateConnectionException(connection.getKey());
    }
  }
View Full Code Here


  public void addConnection(Connection<?> connection) {
    try {
      ConnectionKey connectionKey = connection.getKey();
      getConnection(connectionKey);
      throw new DuplicateConnectionException(connectionKey);
    } catch (NoSuchConnectionException e) {
      connections.add(connection.createData().getProviderId(), connection);
    }
  }
View Full Code Here

    try {
      RemoteUser existingConnection = get(userId, providerId,
          providerUserId);
      if (existingConnection != null)
        throw new DuplicateConnectionException(new ConnectionKey(
            providerId, providerUserId));
    } catch (EmptyResultDataAccessException e) {
    }

    save(remoteUser);
View Full Code Here

    connectionFactoryLocator.addConnectionFactory(connectionFactory2);       
    StubConnectionRepository connectionRepository = new StubConnectionRepository();
    MockMvc mockMvc = standaloneSetup(new ConnectController(connectionFactoryLocator, connectionRepository)).build();
   
    // Should convert errors in "flash" scope to model attributes and remove them from "flash"
    mockMvc.perform(get("/connect/oauth2Provider").sessionAttr("social_addConnection_duplicate", new DuplicateConnectionException(null)))
      .andExpect(view().name("connect/oauth2ProviderConnect"))
      .andExpect(request().sessionAttribute("social_addConnection_duplicate", nullValue()))
      .andExpect(request().attribute("social_addConnection_duplicate", true));

    mockMvc.perform(get("/connect/oauth2Provider").sessionAttr("social_provider_error", new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR)))
View Full Code Here

TOP

Related Classes of org.springframework.social.connect.DuplicateConnectionException

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.