io.sphere.sdk.client.Tokens Maven / Gradle / Ivy
package io.sphere.sdk.client;
import java.util.Optional;
import com.google.common.base.Strings;
import net.jcip.annotations.Immutable;
/** OAuth tokens returned by the authorization server. */
@Immutable
final class Tokens {
private final String accessToken;
private final String refreshToken;
private final Optional expiresIn;
public Tokens(String accessToken, String refreshToken, Optional expiresIn) {
if (Strings.isNullOrEmpty(accessToken))
throw new SphereClientException("OAuth response must contain an access_token. Was empty.");
this.accessToken = accessToken;
this.refreshToken = refreshToken;
this.expiresIn = expiresIn;
}
public String getAccessToken() {
return accessToken;
}
public String getRefreshToken() {
return refreshToken;
}
public Optional getExpiresIn() {
return expiresIn;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy