Java Code Examples for org.springframework.social.oauth2.AccessGrant#getExpireTime()

The following examples show how to use org.springframework.social.oauth2.AccessGrant#getExpireTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OAuth2Applicator.java    From syndesis with Apache License 2.0 6 votes vote down vote up
/**
 * Default implementation that applies {@link SocialProperties} and
 * {@link AccessGrant} to {@link Connection.Builder}.
 */
@Override
public final Connection applyTo(final Connection connection, final AccessGrant accessGrant) {
    final Connection.Builder mutableConnection = new Connection.Builder().createFrom(connection).lastUpdated(new Date());

    Applicator.applyProperty(mutableConnection, clientIdProperty, socialProperties.getAppId());
    Applicator.applyProperty(mutableConnection, clientSecretProperty, socialProperties.getAppSecret());
    Applicator.applyProperty(mutableConnection, accessTokenProperty, accessGrant.getAccessToken());
    Applicator.applyProperty(mutableConnection, refreshTokenProperty, accessGrant.getRefreshToken());
    final Long expireTime = accessGrant.getExpireTime();
    Applicator.applyProperty(mutableConnection, accessTokenExpiresAtProperty, expireTime == null ? null : expireTime.toString());

    additionalApplication(mutableConnection, accessGrant);

    return mutableConnection.build();
}
 
Example 2
Source File: WechatConnectionFactory.java    From cola with MIT License 4 votes vote down vote up
@Override
public Connection<Wechat> createConnection(AccessGrant accessGrant) {
    return new OAuth2Connection<>(getProviderId(), extractProviderUserId(accessGrant), accessGrant.getAccessToken(),
            accessGrant.getRefreshToken(), accessGrant.getExpireTime(), getOAuth2ServiceProvider(), getApiAdapter(extractProviderUserId(accessGrant)));
}
 
Example 3
Source File: WechatMpConnectionFactory.java    From cola with MIT License 4 votes vote down vote up
@Override
public Connection<WechatMp> createConnection(AccessGrant accessGrant) {
    return new OAuth2Connection<>(getProviderId(), extractProviderUserId(accessGrant), accessGrant.getAccessToken(),
            accessGrant.getRefreshToken(), accessGrant.getExpireTime(), getOAuth2ServiceProvider(), getApiAdapter(extractProviderUserId(accessGrant)));
}
 
Example 4
Source File: WeixinConnectionFactory.java    From pre with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Connection<Weixin> createConnection(AccessGrant accessGrant) {
    return new OAuth2Connection<Weixin>(getProviderId(), extractProviderUserId(accessGrant), accessGrant.getAccessToken(),
            accessGrant.getRefreshToken(), accessGrant.getExpireTime(), getOAuth2ServiceProvider(), getApiAdapter(extractProviderUserId(accessGrant)));
}
 
Example 5
Source File: WeiXinConnectionFactory.java    From FEBS-Security with Apache License 2.0 4 votes vote down vote up
@Override
public Connection<WeiXin> createConnection(AccessGrant accessGrant) {
    return new OAuth2Connection<>(getProviderId(), extractProviderUserId(accessGrant), accessGrant.getAccessToken(),
            accessGrant.getRefreshToken(), accessGrant.getExpireTime(), getOAuth2ServiceProvider(), getApiAdapter(extractProviderUserId(accessGrant)));
}
 
Example 6
Source File: YahooOAuth2ConnectionFactory.java    From cloudstreetmarket.com with GNU General Public License v3.0 4 votes vote down vote up
public Connection<Yahoo2> createConnection(AccessGrant accessGrant) {
	return new OAuth2Connection<Yahoo2>(getProviderId(), extractProviderUserId(accessGrant), accessGrant.getAccessToken(),
			accessGrant.getRefreshToken(), accessGrant.getExpireTime(), getOAuth2ServiceProviderWithGuid(accessGrant), getApiAdapter());		
}
 
Example 7
Source File: WeixinConnectionFactory.java    From paascloud-master with Apache License 2.0 2 votes vote down vote up
/**
 * Create connection connection.
 *
 * @param accessGrant the access grant
 *
 * @return the connection
 */
@Override
public Connection<Weixin> createConnection(AccessGrant accessGrant) {
	return new OAuth2Connection<>(getProviderId(), extractProviderUserId(accessGrant), accessGrant.getAccessToken(),
			accessGrant.getRefreshToken(), accessGrant.getExpireTime(), getOAuth2ServiceProvider(), getApiAdapter(extractProviderUserId(accessGrant)));
}