|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -97,20 +97,19 @@ public static Builder withResponse(OAuth2AccessTokenResponse response) {
|
97 | 97 | public static class Builder {
|
98 | 98 | private String tokenValue;
|
99 | 99 | private OAuth2AccessToken.TokenType tokenType;
|
| 100 | + private Instant issuedAt; |
| 101 | + private Instant expiresAt; |
100 | 102 | private long expiresIn;
|
101 | 103 | private Set<String> scopes;
|
102 | 104 | private String refreshToken;
|
103 | 105 | private Map<String, Object> additionalParameters;
|
104 | 106 |
|
105 |
| - private Instant issuedAt; |
106 |
| - private Instant expiresAt; |
107 |
| - |
108 | 107 | private Builder(OAuth2AccessTokenResponse response) {
|
109 | 108 | OAuth2AccessToken accessToken = response.getAccessToken();
|
110 | 109 | this.tokenValue = accessToken.getTokenValue();
|
111 | 110 | this.tokenType = accessToken.getTokenType();
|
112 |
| - this.expiresAt = accessToken.getExpiresAt(); |
113 | 111 | this.issuedAt = accessToken.getIssuedAt();
|
| 112 | + this.expiresAt = accessToken.getExpiresAt(); |
114 | 113 | this.scopes = accessToken.getScopes();
|
115 | 114 | this.refreshToken = response.getRefreshToken() == null ?
|
116 | 115 | null : response.getRefreshToken().getTokenValue();
|
@@ -140,6 +139,7 @@ public Builder tokenType(OAuth2AccessToken.TokenType tokenType) {
|
140 | 139 | */
|
141 | 140 | public Builder expiresIn(long expiresIn) {
|
142 | 141 | this.expiresIn = expiresIn;
|
| 142 | + this.expiresAt = null; |
143 | 143 | return this;
|
144 | 144 | }
|
145 | 145 |
|
@@ -183,7 +183,6 @@ public Builder additionalParameters(Map<String, Object> additionalParameters) {
|
183 | 183 | */
|
184 | 184 | public OAuth2AccessTokenResponse build() {
|
185 | 185 | Instant issuedAt = getIssuedAt();
|
186 |
| - |
187 | 186 | Instant expiresAt = getExpiresAt();
|
188 | 187 |
|
189 | 188 | OAuth2AccessTokenResponse accessTokenResponse = new OAuth2AccessTokenResponse();
|
|
0 commit comments