Ejemplo n.º 1
0
 @Override
 public OAuth2Authentication readAuthentication(String tokenId) {
   /*
   Query query = new Query();
   query.addCriteria(Criteria.where("tokenId").is(tokenId));
   OAuth2AuthenticationAccessToken token = mongoTemplate.findOne(query, OAuth2AuthenticationAccessToken.class, "oauth2_access_token"); */
   OAuth2AuthenticationAccessToken token = oAuth2AccessTokenDao.findByTokenId(tokenId);
   return null == token ? null : token.getAuthentication();
 }
Ejemplo n.º 2
0
 @Override
 public OAuth2AccessToken readAccessToken(String tokenId) {
   /* Query query = new Query();
   query.addCriteria(Criteria.where("tokenId").is(tokenId));
   OAuth2AuthenticationAccessToken token = mongoTemplate.findOne(query, OAuth2AuthenticationAccessToken.class, "oauth2_access_token"); */
   OAuth2AuthenticationAccessToken token = oAuth2AccessTokenDao.findByTokenId(tokenId);
   if (null == token) {
     throw new InvalidTokenException("Token not valid");
   }
   return token.getoAuth2AccessToken();
 }
Ejemplo n.º 3
0
 @Override
 public OAuth2AccessToken getAccessToken(OAuth2Authentication authentication) {
   String authenticationId = authenticationKeyGenerator.extractKey(authentication);
   if (null == authenticationId) {
     return null;
   }
   /*Query query = new Query();
   query.addCriteria(Criteria.where("authenticationId").is(authenticationId));
   OAuth2AuthenticationAccessToken token = mongoTemplate.findOne(query, OAuth2AuthenticationAccessToken.class, "oauth2_access_token"); */
   OAuth2AuthenticationAccessToken token =
       oAuth2AccessTokenDao.findByAuthenticationId(authenticationId);
   return token == null ? null : token.getoAuth2AccessToken();
 }