Fixed bug - removed service layer @Transactional annotations, which negated need for flush at repository level; moved @Transactional annotations.

pull/210/head
Amanda Anganes 2012-09-04 17:50:15 -04:00
parent 48c37129b7
commit 61b828e182
3 changed files with 3 additions and 4 deletions

View File

@ -31,7 +31,6 @@ import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional
public class JpaOAuth2TokenRepository implements OAuth2TokenRepository {
@PersistenceContext

View File

@ -40,7 +40,6 @@ import org.springframework.transaction.annotation.Transactional;
import com.google.common.base.Strings;
@Service
@Transactional
public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEntityService {
private SecureRandom random = new SecureRandom();

View File

@ -50,7 +50,6 @@ import org.springframework.transaction.annotation.Transactional;
*
*/
@Service
@Transactional
public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityService {
private static Logger logger = LoggerFactory.getLogger(DefaultOAuth2ProviderTokenService.class);
@ -114,6 +113,7 @@ public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityServi
//Add the authentication
refreshToken.setAuthenticationHolder(authHolder);
refreshToken.setClient(client);
// save the token first so that we can set it to a member of the access token (NOTE: is this step necessary?)
tokenRepository.saveRefreshToken(refreshToken);
@ -214,7 +214,8 @@ public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityServi
}
if (accessToken.isExpired()) {
tokenRepository.removeAccessToken(accessToken);
//tokenRepository.removeAccessToken(accessToken);
revokeAccessToken(accessToken);
throw new InvalidTokenException("Expired access token: " + accessTokenValue);
}