public static Long getAccessTokenTimeout(final OAuth20TokenGeneratedResult accessTokenResult) {
        return accessTokenResult
            .getAccessToken()
            .map(token -> {
                if (token.isStateless()) {
                    val duration = Duration.between(ZonedDateTime.now(Clock.systemUTC()),
                        token.getExpirationPolicy().toMaximumExpirationTime(token));
                    return duration.toSeconds();
                }
                return ((OAuth20AccessToken) token).getExpiresIn();
            })
            .orElse(0L);
    }
Gets access token timeout (in seconds).

@param accessTokenResult the access token result
@return the access token timeout
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java