Skip to content

Commit c134ec2

Browse files
authored
Merge pull request #829 from AzureAD/avdunn/expose-refreshon
Expose refreshon parameter in authentication result
2 parents 52ed200 + 2af8552 commit c134ec2

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private ITenantProfile getTenantProfile() {
9292
private final String scopes;
9393

9494
@Builder.Default
95-
private final AuthenticationResultMetadata metadata = new AuthenticationResultMetadata();
95+
private final AuthenticationResultMetadata metadata = AuthenticationResultMetadata.builder().build();
9696

9797
@Getter(value = AccessLevel.PACKAGE)
9898
private final Boolean isPopAuthorization;

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResultMetadata.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package com.microsoft.aad.msal4j;
55

66
import lombok.AccessLevel;
7+
import lombok.Builder;
78
import lombok.Getter;
89
import lombok.Setter;
910
import lombok.experimental.Accessors;
@@ -16,17 +17,9 @@
1617
@Accessors(fluent = true)
1718
@Getter
1819
@Setter(AccessLevel.PACKAGE)
20+
@Builder
1921
public class AuthenticationResultMetadata implements Serializable {
2022

2123
private TokenSource tokenSource;
22-
23-
/**
24-
* Sets default metadata values. Used when creating an {@link IAuthenticationResult} before the values are known.
25-
*/
26-
AuthenticationResultMetadata() {
27-
}
28-
29-
AuthenticationResultMetadata(TokenSource tokenSource) {
30-
this.tokenSource = tokenSource;
31-
}
24+
private Long refreshOn;
3225
}

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/TokenRequestExecutor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ private AuthenticationResult createAuthenticationResultFromOauthHttpResponse(
155155
refreshOn(response.getRefreshIn() > 0 ? currTimestampSec + response.getRefreshIn() : 0).
156156
accountCacheEntity(accountCacheEntity).
157157
scopes(response.getScope()).
158-
metadata(new AuthenticationResultMetadata(TokenSource.IDENTITY_PROVIDER)).
158+
metadata(AuthenticationResultMetadata.builder()
159+
.tokenSource(TokenSource.IDENTITY_PROVIDER)
160+
.refreshOn(response.getRefreshIn() > 0 ? currTimestampSec + response.getRefreshIn() : 0)
161+
.build()).
159162
build();
160163

161164
} else {

0 commit comments

Comments
 (0)