Skip to content

Commit 7725fcf

Browse files
HeXeticjricher
authored andcommitted
createAuthorizationCode should be @transactional
An Authentication should not exist without its matching AuthorizationCode, but typically an AuthorizationCode will have a foreign key on an Authentication, meaning it can't be saved first. This block should be wrapped in a transaction so that other DB clients (say, for example, clearExpiredAuthorizationCodes) don't see an inconsistent snapshot and then misbehave.
1 parent c3d0c18 commit 7725fcf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2AuthorizationCodeService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public class DefaultOAuth2AuthorizationCodeService implements AuthorizationCodeS
6666
* @return the authorization code
6767
*/
6868
@Override
69+
@Transactional(value="defaultTransactionManager")
6970
public String createAuthorizationCode(OAuth2Authentication authentication) {
7071
String code = generator.generate();
7172

0 commit comments

Comments
 (0)