Skip to content

Expose refreshon parameter in authentication result#829

Merged
Avery-Dunn merged 2 commits intodevfrom
avdunn/expose-refreshon
Jun 26, 2024
Merged

Expose refreshon parameter in authentication result#829
Avery-Dunn merged 2 commits intodevfrom
avdunn/expose-refreshon

Conversation

@Avery-Dunn
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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
Copy Markdown
Contributor

@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
Copy Markdown
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
@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