Skip to content

Commit 3d6f726

Browse files
authored
Make JCacheCodeDataProvider#removeCodeGrant atomic (#3224)
1 parent f1b2c37 commit 3d6f726

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/code/JCacheCodeDataProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ public List<ServerAuthorizationCodeGrant> getCodeGrants(Client c, UserSubject su
111111

112112
@Override
113113
public ServerAuthorizationCodeGrant removeCodeGrant(String code) throws OAuthServiceException {
114-
ServerAuthorizationCodeGrant grant = getCodeGrant(code);
115-
if (grant != null) {
116-
grantCache.remove(code);
114+
ServerAuthorizationCodeGrant grant = grantCache.getAndRemove(code);
115+
if (grant != null && isExpired(grant)) {
116+
return null;
117117
}
118118
return grant;
119119
}

0 commit comments

Comments
 (0)