Class AccessToken
- java.lang.Object
-
- com.ellucian.ethos.integration.authentication.AccessToken
-
public class AccessToken extends Object
An access token that can be used for authentication to make calls to Ethos Integration. To get an Authorization header that can be used to make HTTP requests, use the getAuthHeader() method. This will return a Map containing a single entry of the Authorization header key/value pair. That can be used as-is or added to an existing headers map to pass to the EthosClient making the requests.- Since:
- 0.0.1
-
-
Constructor Summary
Constructors Constructor Description AccessToken(String token, LocalDateTime expirationTime)
Creates an instance of an access token that expires at the given time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
getAuthHeader()
Gets an HTTP Authorization header containing the access token.LocalDateTime
getExpirationTime()
Gets the time when this access token will expireString
getToken()
Gets the JWT value for this access token.boolean
isValid()
Determines if the token is still valid, meaning that is has a JWT string and it is not expired.
-
-
-
Constructor Detail
-
AccessToken
public AccessToken(String token, LocalDateTime expirationTime)
Creates an instance of an access token that expires at the given time.- Parameters:
token
- an encoded JWT stringexpirationTime
- the time when this token will expire
-
-
Method Detail
-
getToken
public String getToken()
Gets the JWT value for this access token.- Returns:
- encoded JWT string
-
getExpirationTime
public LocalDateTime getExpirationTime()
Gets the time when this access token will expire- Returns:
- the expiration time
-
isValid
public boolean isValid()
Determines if the token is still valid, meaning that is has a JWT string and it is not expired.- Returns:
- if the token is valid.
-
-