Skip to content

Duplicate auth id fix#1186

Open
hilpitome wants to merge 27 commits intov2.1from
duplicate-auth-id-fix
Open

Duplicate auth id fix#1186
hilpitome wants to merge 27 commits intov2.1from
duplicate-auth-id-fix

Conversation

@hilpitome
Copy link
Copy Markdown
Contributor

No description provided.

@hilpitome hilpitome changed the base branch from master to v2.1 February 14, 2023 08:54
Copy link
Copy Markdown
Member

@bennsimon bennsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configs module changes are not part of this fix.


@Override
public void storeAccessToken(final OAuth2AccessToken token, final OAuth2Authentication authentication) {
final String key = authenticationKeyGenerator.extractKey(authentication);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for null authentication.

@Override
public void storeAccessToken(final OAuth2AccessToken token, final OAuth2Authentication authentication) {
final String key = authenticationKeyGenerator.extractKey(authentication);
jdbcTemplate.update("delete from oauth_access_token where authentication_id = ?", key);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for null on key.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log info when jdbcTemplate.update("delete from oauth_access_token where authentication_id = ?", key); eventually finds a duplicate and deletes it.

Copy link
Copy Markdown
Member

@bennsimon bennsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update snapshot version

public void storeAccessToken(final OAuth2AccessToken token, final OAuth2Authentication authentication) {
final String key = authenticationKeyGenerator.extractKey(authentication);
jdbcTemplate.update("delete from oauth_access_token where authentication_id = ?", key);
if( key == null || authentication == null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I think the check for authentication needs to happen before passing the authentication object to the function
  • Evaluate and see if super needs to be called even if we skip the delete operation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super needs to be called since it is mostly operating on the OAuth2AccessToken token.

@hilpitome hilpitome requested a review from ekigamba February 21, 2023 07:15
@Override
public void storeAccessToken(final OAuth2AccessToken token, final OAuth2Authentication authentication) {

if( authentication != null){
Copy link
Copy Markdown
Contributor

@ekigamba ekigamba Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Formatting here and line 103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants