Search in sources :

Example 1 with AppSecretException

use of com.paascloud.security.app.AppSecretException in project paascloud-master by paascloud.

the class AppSingUpUtils method doPostSignUp.

/**
 * 将缓存的社交网站用户信息与系统注册用户信息绑定
 *
 * @param request the request
 * @param userId  the user id
 */
public void doPostSignUp(WebRequest request, String userId) {
    String key = getKey(request);
    if (!redisTemplate.hasKey(key)) {
        throw new AppSecretException("无法找到缓存的用户社交账号信息");
    }
    ConnectionData connectionData = (ConnectionData) redisTemplate.opsForValue().get(key);
    Connection<?> connection = connectionFactoryLocator.getConnectionFactory(connectionData.getProviderId()).createConnection(connectionData);
    usersConnectionRepository.createConnectionRepository(userId).addConnection(connection);
    redisTemplate.delete(key);
}
Also used : AppSecretException(com.paascloud.security.app.AppSecretException) ConnectionData(org.springframework.social.connect.ConnectionData)

Aggregations

AppSecretException (com.paascloud.security.app.AppSecretException)1 ConnectionData (org.springframework.social.connect.ConnectionData)1