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


Java OAuth2RefreshToken.getValue方法代码示例

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


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

示例1: removeAccessTokenUsingRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
@Override
public void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken) {
  String tokenValue = refreshToken.getValue();
  // Lookup RefreshTokenToAccessToken table for locating access token
  RefreshTokenToAccessToken refreshTokenToAccessToken = refreshTokenToAccessTokenRepository.findOne(tokenValue);
  if (refreshTokenToAccessToken != null) {
    String accessTokenKey = refreshTokenToAccessToken.getAccessTokenKey();
    AccessToken accessToken = accessTokenRepository.findOne(accessTokenKey);
    String jsonOAuth2AccessToken = accessToken.getoAuth2AccessToken();
    OAuth2AccessToken oAuth2AccessToken = OAuthUtil.deserializeOAuth2AccessToken(jsonOAuth2AccessToken);
    // Delete access token from all related tables
    List<RegularStatement> statementList = prepareRemoveAccessTokenStatements(oAuth2AccessToken);
    // Delete from RefreshTokenToAccessToken table
    Delete refreshTokenToAccessTokenDelete = CassandraTemplate.createDeleteQuery(RefreshTokenToAccessToken.TABLE, refreshTokenToAccessToken, null, cassandraTemplate.getConverter());
    statementList.add(refreshTokenToAccessTokenDelete);
    Batch batch = QueryBuilder.batch(statementList.toArray(new RegularStatement[statementList.size()]));
    cassandraTemplate.execute(batch);
  }
}
 
开发者ID:Mert-Z,项目名称:spring-oauth2-cassandra-token-store,代码行数:20,代码来源:CassandraTokenStore.java

示例2: createRefreshTokenCookie

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
/**
 * Create a cookie out of the given refresh token.
 * Refresh token cookies contain the base64 encoded refresh token (a JWT token).
 * They also contain a hint whether the refresh token was for remember me or not.
 * If not, then the cookie will be prefixed by the timestamp it was created at followed by a pipe '|'.
 * This gives us the chance to expire session cookies regardless of the token duration.
 */
private Cookie createRefreshTokenCookie(OAuth2RefreshToken refreshToken, boolean rememberMe) {
    int maxAge = -1;
    String name = SESSION_TOKEN_COOKIE;
    String value = refreshToken.getValue();
    if (rememberMe) {
        name = REFRESH_TOKEN_COOKIE;
        //get expiration in seconds from the token's "exp" claim
        Integer exp = getClaim(refreshToken.getValue(), AccessTokenConverter.EXP, Integer.class);
        if (exp != null) {
            int now = (int) (System.currentTimeMillis() / 1000L);
            maxAge = exp - now;
            log.debug("refresh token valid for another {} secs", maxAge);
            //let cookie expire a bit earlier than the token to avoid race conditions
            maxAge -= REFRESH_TOKEN_EXPIRATION_WINDOW_SECS;
        }
    }
    Cookie refreshTokenCookie = new Cookie(name, value);
    refreshTokenCookie.setMaxAge(maxAge);
    return refreshTokenCookie;
}
 
开发者ID:jhipster,项目名称:generator-jhipster,代码行数:28,代码来源:_OAuth2CookieHelper.java

示例3: removeRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
@Override
public void removeRefreshToken(OAuth2RefreshToken token) {
  String tokenValue = token.getValue();
  List<RegularStatement> statementList = new ArrayList<RegularStatement>();
  // Delete from RefreshToken table
  statementList.add(prepareDeleteByPrimaryKeyRegularStatement(RefreshToken.class, tokenValue));
  // Delete from RefreshTokenAuthentication table
  statementList.add(prepareDeleteByPrimaryKeyRegularStatement(RefreshTokenAuthentication.class, tokenValue));
  // Delete from RefreshTokenToAccessToken table
  statementList.add(prepareDeleteByPrimaryKeyRegularStatement(RefreshTokenToAccessToken.class, tokenValue));
  Batch batch = QueryBuilder.batch(statementList.toArray(new RegularStatement[statementList.size()]));
  cassandraTemplate.execute(batch);
}
 
开发者ID:Mert-Z,项目名称:spring-oauth2-cassandra-token-store,代码行数:14,代码来源:CassandraTokenStore.java

示例4: convert

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
private io.gravitee.am.repository.oauth2.model.OAuth2RefreshToken convert(OAuth2RefreshToken _oAuth2RefreshToken) {
    io.gravitee.am.repository.oauth2.model.OAuth2RefreshToken oAuth2RefreshToken = new io.gravitee.am.repository.oauth2.model.OAuth2RefreshToken(_oAuth2RefreshToken.getValue());
    if (_oAuth2RefreshToken instanceof DefaultExpiringOAuth2RefreshToken) {
        oAuth2RefreshToken.setExpiration(((DefaultExpiringOAuth2RefreshToken) _oAuth2RefreshToken).getExpiration());
    }
    return oAuth2RefreshToken;
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:8,代码来源:RepositoryTokenStore.java

示例5: revokeRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
@Nullable
public String revokeRefreshToken(String tokenValue, Authentication clientAuth) {
    OAuth2RefreshToken refreshToken = tokenStore.readRefreshToken(tokenValue);
    if (refreshToken != null) {
        OAuth2Authentication authToRevoke = tokenStore.readAuthenticationForRefreshToken(refreshToken);
        checkIfTokenIsIssuedToClient(clientAuth, authToRevoke);
        tokenStore.removeAccessTokenUsingRefreshToken(refreshToken);
        tokenStore.removeRefreshToken(refreshToken);
        log.debug("Successfully removed refresh token {} (and any associated access token).", refreshToken);
        return refreshToken.getValue();
    }

    log.debug("No refresh token {} found in the token store.", tokenValue);
    return null;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:OAuthTokenRevoker.java

示例6: OAuth2AuthenticationRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
/**
 * Create the refresh token.
 */
public OAuth2AuthenticationRefreshToken(OAuth2RefreshToken oauth2RefreshToken,
    OAuth2Authentication authentication) {
  this.id = UUID.randomUUID()
    .toString();
  this.oauth2RefreshToken = oauth2RefreshToken;
  this.authentication = authentication;
  this.tokenId = oauth2RefreshToken.getValue();
}
 
开发者ID:dzhw,项目名称:metadatamanagement,代码行数:12,代码来源:OAuth2AuthenticationRefreshToken.java

示例7: OAuth2AuthenticationRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
public OAuth2AuthenticationRefreshToken(
		OAuth2RefreshToken oAuth2RefreshToken,
		OAuth2Authentication authentication) {
	this.oAuth2RefreshToken = oAuth2RefreshToken;
	this.authentication = authentication;
	this.tokenId = oAuth2RefreshToken.getValue();
}
 
开发者ID:xxing1982,项目名称:EDU_SYZT,代码行数:8,代码来源:OAuth2AuthenticationRefreshToken.java

示例8: storeRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
@Override
public void storeRefreshToken(OAuth2RefreshToken refreshToken, OAuth2Authentication authentication) {
	CouchbaseOAuth2RefreshToken couchBaseRefreshToken = new CouchbaseOAuth2RefreshToken(refreshToken.getValue());
	couchBaseRefreshToken.setAuthentication(Base64.encodeBase64String(serializeAuthentication(authentication)));
	
	OAuth2AccessToken accessToken = getAccessToken(authentication);
	if (accessToken != null) {
		couchBaseRefreshToken.setAccessTokenId(accessToken.getValue());
	} else {
		if (LOG.isInfoEnabled()) {
			LOG.info("Failed to find access token for authentication while storing refresh token " + authentication);
		}
	}
	oAuth2RefreshTokenService.save(couchBaseRefreshToken);
}
 
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:16,代码来源:SpringDataTokenStore.java

示例9: removeRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
@Override
public void removeRefreshToken(OAuth2RefreshToken token) {
    if (null != token && null != token.getValue()) {
        oAuth2RefreshTokenRepository.delete(token.getValue());
    }
}
 
开发者ID:reportportal,项目名称:service-authorization,代码行数:7,代码来源:OAuth2MongoTokenStore.java

示例10: OAuth2AuthenticationRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
public OAuth2AuthenticationRefreshToken(OAuth2RefreshToken oAuth2RefreshToken, OAuth2Authentication authentication) {
    this.id = UUID.randomUUID().toString();
    this.oAuth2RefreshToken = oAuth2RefreshToken;
    this.authentication = authentication;
    this.tokenId = oAuth2RefreshToken.getValue();
}
 
开发者ID:xetys,项目名称:jhipster-ribbon-hystrix,代码行数:7,代码来源:_OAuth2AuthenticationRefreshToken.java

示例11: setRefreshTokenAsCokie

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
public static void setRefreshTokenAsCokie(HttpServletResponse response, OAuth2RefreshToken token, int expiry) {
    Cookie cookie = new Cookie("refreshToken", token.getValue());
    cookie.setMaxAge(expiry);
    response.addCookie(cookie);
}
 
开发者ID:imCodePartnerAB,项目名称:iVIS,代码行数:6,代码来源:IvisOAuth2Utils.java

示例12: OAuth2AuthenticationRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
public OAuth2AuthenticationRefreshToken(OAuth2RefreshToken oAuth2RefreshToken, OAuth2Authentication authentication) {
    this.oAuth2RefreshToken = oAuth2RefreshToken;
    this.authentication = authentication;
    this.tokenId = oAuth2RefreshToken.getValue();
}
 
开发者ID:thpham,项目名称:ithings-demo,代码行数:6,代码来源:OAuth2AuthenticationRefreshToken.java

示例13: AuthenticationRefreshToken

import org.springframework.security.oauth2.common.OAuth2RefreshToken; //导入方法依赖的package包/类
/**
 * Create a new OAuth2 Refresh Token holder.
 *
 * @param refreshToken   The Refresh Token.
 * @param authentication The authentication.
 */
public AuthenticationRefreshToken(OAuth2RefreshToken refreshToken, OAuth2Authentication authentication) {
    this.refreshToken = refreshToken;
    this.authentication = authentication;
    this.tokenId = refreshToken.getValue();
}
 
开发者ID:BakkerTom,项目名称:happy-news,代码行数:12,代码来源:AuthenticationRefreshToken.java


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