当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionData.getProviderId方法代码示例

本文整理汇总了Java中org.springframework.social.connect.ConnectionData.getProviderId方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectionData.getProviderId方法的具体用法?Java ConnectionData.getProviderId怎么用?Java ConnectionData.getProviderId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.social.connect.ConnectionData的用法示例。


在下文中一共展示了ConnectionData.getProviderId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateConnection

import org.springframework.social.connect.ConnectionData; //导入方法依赖的package包/类
public void updateConnection(Connection<?> connection) {
	ConnectionData data = connection.createData();
	SQLiteDatabase db = repositoryHelper.getWritableDatabase();
	ContentValues values = new ContentValues();
	values.put("displayName", data.getDisplayName());
	values.put("profileUrl", data.getProfileUrl());
	values.put("imageUrl", data.getImageUrl());
	values.put("accessToken", encrypt(data.getAccessToken()));
	values.put("secret", encrypt(data.getSecret()));
	values.put("refreshToken", encrypt(data.getRefreshToken()));
	values.put("expireTime", data.getExpireTime());
	final String whereClause = "userId = ? and providerId = ? and providerUserId = ?";
	final String[] whereArgs = { userId, data.getProviderId(), data.getProviderUserId() };
	db.update("UserConnection", values, whereClause, whereArgs);
	db.close();
}
 
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:17,代码来源:SQLiteConnectionRepository.java

示例2: addConnection

import org.springframework.social.connect.ConnectionData; //导入方法依赖的package包/类
@Override
@Transactional
public void addConnection(final Connection<?> connection) {

    final ConnectionData connectionData = connection.createData();
    final String providerId = connectionData.getProviderId();
    final String providerUserId = connectionData.getProviderUserId();

    final int rank = userConnectionRepository.findRank(user, providerId);

    final UserConnection userConnection = Functions.toUserConnection(textEncryptor, rank, user)
                                                   .apply(connectionData);

    if (userConnectionRepository.findOne(user, providerId, providerUserId) != null) {
        throw new DuplicateConnectionException(connection.getKey());
    }
    userConnectionRepository.save(userConnection);
}
 
开发者ID:martinlau,项目名称:unidle-old,代码行数:19,代码来源:ConnectionRepositoryImpl.java

示例3: SocialAuthenticationToken

import org.springframework.social.connect.ConnectionData; //导入方法依赖的package包/类
/**
 * @param connection connection data
 * @param providerAccountData optional extra account data
 */
public SocialAuthenticationToken(final Connection<?> connection, Map<String, String> providerAccountData) {
    super(null);
    Assert.notNull(connection);
    ConnectionData connectionData = connection.createData();
    Assert.notNull(connectionData.getProviderId());
    if (connectionData.getExpireTime() != null && connectionData.getExpireTime() < System.currentTimeMillis()) {
        throw new IllegalArgumentException("connection.expireTime < currentTime");
    }
    this.providerId = connectionData.getProviderId();
    this.connection = connection;
    this.principle = null; //no principal yet
    if (providerAccountData != null) {
        this.providerAccountData = Collections.unmodifiableMap(new HashMap<String, String>(providerAccountData));
    } else {
        this.providerAccountData = Collections.emptyMap();
    }
    super.setAuthenticated(false);
}
 
开发者ID:amobiz,项目名称:spring-social-showcase-sec-appengine,代码行数:23,代码来源:SocialAuthenticationToken.java

示例4: UserConnection

import org.springframework.social.connect.ConnectionData; //导入方法依赖的package包/类
public UserConnection(ConnectionData connectionData, String userId)
{
	this.userId = userId;
	this.providerId = connectionData.getProviderId();
	this.providerUserId = connectionData.getProviderUserId();
	this.rank = 1;
	this.displayName = connectionData.getDisplayName();
	this.profileUrl = connectionData.getProfileUrl();
	this.imageUrl = connectionData.getImageUrl();
	this.accessToken = connectionData.getAccessToken();
	this.secret = connectionData.getSecret();
	this.refreshToken = connectionData.getRefreshToken();
	this.expireTime = connectionData.getExpireTime();
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:15,代码来源:UserConnection.java

示例5: addConnection

import org.springframework.social.connect.ConnectionData; //导入方法依赖的package包/类
public void addConnection(Connection<?> connection) {
	try {
		ConnectionData data = connection.createData();
		SQLiteDatabase db = repositoryHelper.getWritableDatabase();

		// generate rank
		final String sql = "select coalesce(max(rank) + 1, 1) as rank from UserConnection where userId = ? and providerId = ?";
		final String[] selectionArgs = { userId, data.getProviderId() };
		Cursor c = db.rawQuery(sql, selectionArgs);
		c.moveToFirst();
		int rank = c.getInt(c.getColumnIndex("rank"));
		c.close();

		// insert connection
		ContentValues values = new ContentValues();
		values.put("userId", userId);
		values.put("providerId", data.getProviderId());
		values.put("providerUserId", data.getProviderUserId());
		values.put("rank", rank);
		values.put("displayName", data.getDisplayName());
		values.put("profileUrl", data.getProfileUrl());
		values.put("imageUrl", data.getImageUrl());
		values.put("accessToken", encrypt(data.getAccessToken()));
		values.put("secret", encrypt(data.getSecret()));
		values.put("refreshToken", encrypt(data.getRefreshToken()));
		values.put("expireTime", data.getExpireTime());
		db.insertOrThrow("UserConnection", null, values);
		db.close();
	} catch (SQLiteConstraintException e) {
		throw new DuplicateConnectionException(connection.getKey());
	}
}
 
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:33,代码来源:SQLiteConnectionRepository.java

示例6: updateConnection

import org.springframework.social.connect.ConnectionData; //导入方法依赖的package包/类
@Override
@Transactional
public void updateConnection(final Connection<?> connection) {

    final ConnectionData connectionData = connection.createData();
    final String providerId = connectionData.getProviderId();
    final String providerUserId = connectionData.getProviderUserId();

    final UserConnection userConnection = userConnectionRepository.findOne(user, providerId, providerUserId);

    final UserConnection updatedUserConnection = Functions.toUserConnection(userConnection, textEncryptor, user)
                                                          .apply(connectionData);

    userConnectionRepository.save(updatedUserConnection);
}
 
开发者ID:martinlau,项目名称:unidle-old,代码行数:16,代码来源:ConnectionRepositoryImpl.java

示例7: updateConnection

import org.springframework.social.connect.ConnectionData; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void updateConnection(Connection<?> connection) {
	ConnectionData cd = connection.createData();
	AppUserSocialConnectionKey primaryKey = new AppUserSocialConnectionKey(findAppUser(), cd.getProviderId(), cd.getProviderUserId());
	AppUserSocialConnection ausc = entityManager.find(AppUserSocialConnection.class, primaryKey);
	ausc.setDisplayName(cd.getDisplayName());
	ausc.setProfileUrl(cd.getProfileUrl());
	ausc.setImageUrl(cd.getImageUrl());
	ausc.setAccessToken(encrypt(cd.getAccessToken()));
	ausc.setSecret(encrypt(cd.getSecret()));
	ausc.setRefreshToken(encrypt(cd.getRefreshToken()));
	ausc.setExpireTime(cd.getExpireTime());
	entityManager.merge(ausc);
}
 
开发者ID:davejoyce,项目名称:composite-dao,代码行数:17,代码来源:JpaConnectionRepository.java

示例8: addConnection

import org.springframework.social.connect.ConnectionData; //导入方法依赖的package包/类
public void addConnection(Connection<?> connection) {
    //check cardinality
    SocialAuthenticationService<?> socialAuthenticationService = 
            this.socialAuthenticationServiceLocator.getAuthenticationService(connection.getKey().getProviderId());
    if (socialAuthenticationService.getConnectionCardinality() == ConnectionCardinality.ONE_TO_ONE ||
            socialAuthenticationService.getConnectionCardinality() == ConnectionCardinality.ONE_TO_MANY){
        List<UserSocialConnection> storedConnections = 
                this.userSocialConnectionRepository.findByProviderIdAndProviderUserId(
                        connection.getKey().getProviderId(), connection.getKey().getProviderUserId());
        if (storedConnections.size() > 0){
            //not allow one providerId/providerUserId connect to multiple userId
            throw new DuplicateConnectionException(connection.getKey());
        }
    }
    
    UserSocialConnection userSocialConnection = this.userSocialConnectionRepository
            .findByUserIdAndProviderIdAndProviderUserId(userId, connection.getKey().getProviderId(), 
                    connection.getKey().getProviderUserId());
    if (userSocialConnection == null) {
        ConnectionData data = connection.createData();
        userSocialConnection = new UserSocialConnection(userId, data.getProviderId(), data.getProviderUserId(), 0,
                data.getDisplayName(), data.getProfileUrl(), data.getImageUrl(), encrypt(data.getAccessToken()),
                encrypt(data.getSecret()), encrypt(data.getRefreshToken()), data.getExpireTime());
        this.userSocialConnectionRepository.save(userSocialConnection);
    } else {
        throw new DuplicateConnectionException(connection.getKey());
    }
}
 
开发者ID:jiwhiz,项目名称:JiwhizBlogWeb,代码行数:29,代码来源:MongoConnectionRepositoryImpl.java


注:本文中的org.springframework.social.connect.ConnectionData.getProviderId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。