Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate auth id fix #1186

Open
wants to merge 27 commits into
base: v2.1
Choose a base branch
from
Open

Duplicate auth id fix #1186

wants to merge 27 commits into from

Conversation

hilpitome
Copy link
Contributor

No description provided.

@hilpitome hilpitome changed the base branch from master to v2.1 February 14, 2023 08:54
Copy link
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
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
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
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
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

return new JdbcTokenStore(dataSource) {

@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);
if( key == null || authentication == null)
Copy link
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
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
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