Skip to content

Commit

Permalink
Merge pull request #829 from AzureAD/avdunn/expose-refreshon
Browse files Browse the repository at this point in the history
Expose refreshon parameter in authentication result
  • Loading branch information
Avery-Dunn committed Jun 26, 2024
2 parents 52ed200 + 2af8552 commit c134ec2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private ITenantProfile getTenantProfile() {
private final String scopes;

@Builder.Default
private final AuthenticationResultMetadata metadata = new AuthenticationResultMetadata();
private final AuthenticationResultMetadata metadata = AuthenticationResultMetadata.builder().build();

@Getter(value = AccessLevel.PACKAGE)
private final Boolean isPopAuthorization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.microsoft.aad.msal4j;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
Expand All @@ -16,17 +17,9 @@
@Accessors(fluent = true)
@Getter
@Setter(AccessLevel.PACKAGE)
@Builder
public class AuthenticationResultMetadata implements Serializable {

private TokenSource tokenSource;

/**
* Sets default metadata values. Used when creating an {@link IAuthenticationResult} before the values are known.
*/
AuthenticationResultMetadata() {
}

AuthenticationResultMetadata(TokenSource tokenSource) {
this.tokenSource = tokenSource;
}
private Long refreshOn;
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ private AuthenticationResult createAuthenticationResultFromOauthHttpResponse(
refreshOn(response.getRefreshIn() > 0 ? currTimestampSec + response.getRefreshIn() : 0).
accountCacheEntity(accountCacheEntity).
scopes(response.getScope()).
metadata(new AuthenticationResultMetadata(TokenSource.IDENTITY_PROVIDER)).
metadata(AuthenticationResultMetadata.builder()
.tokenSource(TokenSource.IDENTITY_PROVIDER)
.refreshOn(response.getRefreshIn() > 0 ? currTimestampSec + response.getRefreshIn() : 0)
.build()).
build();

} else {
Expand Down

0 comments on commit c134ec2

Please sign in to comment.