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

net.leanix.dropkit.oauth.token.OAuth2Token Maven / Gradle / Ivy

There is a newer version: 2.0.10
Show newest version
package net.leanix.dropkit.oauth.token;

import java.util.Date;
import java.util.UUID;
import net.leanix.dropkit.oauth.models.Principal;

public class OAuth2Token {
    private UUID id;
    private U principal;
    private Date expiration;
    private String refreshToken;
    private Date refreshExpiration;

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }

    public U getPrincipal() {
        return principal;
    }

    public void setPrincipal(U principal) {
        this.principal = principal;
    }

    public Date getExpiration() {
        return expiration;
    }

    public void setExpiration(Date expiration) {
        this.expiration = expiration;
    }

    public boolean isExpired() {
        if (this.expiration == null)
            throw new RuntimeException("No expiration has been set");

        Date now = new Date();
        return now.compareTo(this.expiration) >= 0;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public Date getRefreshExpiration() {
        return refreshExpiration;
    }

    public void setRefreshExpiration(Date refreshExpiration) {
        this.refreshExpiration = refreshExpiration;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy