com.clouway.oauth2.client.TokenSource Maven / Gradle / Ivy
The newest version!
package com.clouway.oauth2.client;
import java.io.IOException;
import java.util.Date;
import java.util.Optional;
/**
* TokenSource is a generic source for retrieving a new tokens.
*
* @author Miroslav Genov ([email protected])
*/
public interface TokenSource {
/**
* Takes a token from token source by using the provided instant time to ensure that
* token was passed.
*
* @param instant the time on which token request was initiated
* @return the requested token or absent value if token is not available
* @throws IOException is thrown in case UI failure during token retrieval
*/
Optional token(Date instant) throws IOException;
}