net.leanix.dropkit.oauth.token.OAuth2Token Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leanix-dropkit Show documentation
Show all versions of leanix-dropkit Show documentation
Base functionality for leanIX dropwizard-based services
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