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

Expose refreshon parameter in authentication result #829

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

Avery-Dunn
Copy link
Collaborator

Exposes the refresh on parameter in the AuthenticationResultMetadata field of an AuthenticationResult, as per #822

Also replaces the (package-private) AuthenticationResultMetadata constructors with lombok's builder annotation to better handle setting the new refreshOn field and any others that may get added.

@Avery-Dunn Avery-Dunn requested a review from a team as a code owner June 24, 2024 20:12
@@ -155,7 +155,10 @@ private AuthenticationResult createAuthenticationResultFromOauthHttpResponse(
refreshOn(response.getRefreshIn() > 0 ? currTimestampSec + response.getRefreshIn() : 0).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this already exposed in AuthenticationResult? If it is why do we need it in the metadata as well? If this makes more sense in metadata, maybe remove it from here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

refreshOn is a field in AuthenticationResult but not the IAuthenticationResult interface, and the return type of our acquireToken methods is IAuthenticationResult. AuthenticationResult itself is a package-private, so other projects can only see the fields in IAuthenticationResult

For various historical design reasons IAuthenticationResult has most of the fields listed out individually but that's not very expandable: adding a new field to a public interface is considered a breaking change unless we also add a (potentially meaningless) default value, but that's considered a bad practice.

That's the reason the AuthenticationResultMetadata class was introduced: adding new fields to that is not a breaking change, and it can be a bucket for more niche things like refreshOn that most users will not need to worry about.

Copy link
Collaborator

@neha-bhargava neha-bhargava left a comment

Choose a reason for hiding this comment

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

Approved with comments.

Copy link
Member

@bgavrilMS bgavrilMS left a comment

Choose a reason for hiding this comment

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

No unit tests

@Avery-Dunn Avery-Dunn merged commit c134ec2 into dev Jun 26, 2024
5 checks passed
@Avery-Dunn Avery-Dunn mentioned this pull request Jun 26, 2024
@Avery-Dunn Avery-Dunn deleted the avdunn/expose-refreshon branch July 15, 2024 19:20
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