All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.checkout.OAuthAccessToken Maven / Gradle / Ivy

There is a newer version: 6.4.2
Show newest version
package com.checkout;

import java.time.LocalDateTime;

import static java.time.LocalDateTime.now;

final class OAuthAccessToken {

    private final String token;
    private final LocalDateTime expirationDate;

    OAuthAccessToken(final String token, final LocalDateTime expirationDate) {
        this.token = token;
        this.expirationDate = expirationDate;
    }

    boolean isValid() {
        if (expirationDate == null) {
            return false;
        }
        return expirationDate.isAfter(now());
    }

    String getToken() {
        return token;
    }

    LocalDateTime getExpirationDate() {
        return expirationDate;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy