@@ -210,15 +210,15 @@ static class AppInstallationToken implements Serializable {
210210 * The time-to-live for the token may be less than this if the initial expiration for the token when
211211 * it is returned from GitHub is less than this.
212212 */
213- private final static long MINIMUM_SECONDS_UNTIL_EXPIRATION = Duration .ofMinutes (45 ).getSeconds ();
213+ static final long MINIMUM_SECONDS_UNTIL_EXPIRATION = Duration .ofMinutes (45 ).getSeconds ();
214214
215215 /**
216216 * Any token older than this is considered stale.
217217 *
218218 * This is a back stop to ensure that, in case of unforeseen error,
219219 * expired tokens are not accidentally retained past their expiration.
220220 */
221- private static final long MAXIMUM_AGE_SECONDS = Duration .ofMinutes (30 ).getSeconds ();
221+ static final long MAXIMUM_AGE_SECONDS = Duration .ofMinutes (30 ).getSeconds ();
222222
223223 private final String token ;
224224 private final long tokenStaleEpochSeconds ;
@@ -227,25 +227,25 @@ static class AppInstallationToken implements Serializable {
227227 * Create a AppInstallationToken instance.
228228 *
229229 * @param token the token string
230- * @param tokenExpirationEpochSeconds the time in epoch seconds that this token will expire
230+ * @param expirationEpochSeconds the time in epoch seconds that this token will expire
231231 */
232- public AppInstallationToken (String token , long tokenExpirationEpochSeconds ) {
232+ public AppInstallationToken (String token , long expirationEpochSeconds ) {
233233 long nextSecond = Instant .now ().getEpochSecond () + 1 ;
234234
235235 // Tokens go stale a while before they will expire
236- long tokenStaleEpochSeconds = tokenExpirationEpochSeconds - MINIMUM_SECONDS_UNTIL_EXPIRATION ;
236+ long staleEpochSeconds = expirationEpochSeconds - MINIMUM_SECONDS_UNTIL_EXPIRATION ;
237237
238238 // Tokens are not stale as soon as they are made
239- if (tokenStaleEpochSeconds < nextSecond ) {
240- tokenStaleEpochSeconds = nextSecond ;
239+ if (staleEpochSeconds < nextSecond ) {
240+ staleEpochSeconds = nextSecond ;
241241 } else {
242242 // Tokens have a maximum age at which they go stale
243- tokenStaleEpochSeconds = Math .min (tokenExpirationEpochSeconds , nextSecond + MAXIMUM_AGE_SECONDS );
243+ staleEpochSeconds = Math .min (staleEpochSeconds , nextSecond + MAXIMUM_AGE_SECONDS );
244244 }
245- LOGGER .log (Level .FINER , "Token stale time epoch seconds: {0}" , tokenStaleEpochSeconds );
245+ LOGGER .log (Level .FINER , "Token stale time epoch seconds: {0}" , staleEpochSeconds );
246246
247247 this .token = token ;
248- this .tokenStaleEpochSeconds = tokenStaleEpochSeconds ;
248+ this .tokenStaleEpochSeconds = staleEpochSeconds ;
249249 }
250250
251251 public String getToken () {
@@ -265,6 +265,10 @@ public boolean isStale() {
265265 return Instant .now ().getEpochSecond () >= tokenStaleEpochSeconds ;
266266 }
267267
268+ long getTokenStaleEpochSeconds () {
269+ return tokenStaleEpochSeconds ;
270+ }
271+
268272 }
269273
270274 /**
0 commit comments