Class RefreshableTokenDataImpl
- java.lang.Object
-
- jetbrains.buildServer.connections.ExpiringAccessTokenImpl
-
- jetbrains.buildServer.serverSide.connections.RefreshableTokenDataImpl
-
- All Implemented Interfaces:
AccessToken
,ExpiringAccessToken
,RefreshableTokenData
- Direct Known Subclasses:
RefreshableTokenImpl
public class RefreshableTokenDataImpl extends ExpiringAccessTokenImpl implements RefreshableTokenData
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.connections.AccessToken
TOKEN_ID_PREFIX
-
-
Constructor Summary
Constructors Constructor Description RefreshableTokenDataImpl(String accessToken, String scope, String oauthLogin, int timeToLiveSeconds, long teamCityUserId, long createTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addContextKey(String contextKey)
Adds a context key to the set of allowed context keysvoid
addContextKeys(Collection<String> contextKeys)
Adds context keys defining where the token is applicableboolean
equals(Object o)
Set<String>
getAccessibleEntities()
A token could be not only limited by its scope, but also by the entities that can be accessed with it, such as repositories for exampleSet<String>
getContextKeys()
Date
getCreateDate()
Boolean
getFailedToRefresh()
String
getName()
String
getOauthLogin()
Long
getRecordCreateTimeMs()
This returns the logical creation timestamp of the token record.String
getRefreshToken()
String
getScope()
long
getTeamCityUserId()
int
getTimeToLiveSeconds()
int
hashCode()
boolean
isAllowedForEntity(String entityId)
boolean
isPermanent()
void
removeContextKey(String contextKey)
Removes a context key from the set of allowed context keysvoid
setAccessibleEntities(Collection<String> accessibleEntities)
Sets accessible entitiesvoid
setFailedToRefresh(Boolean failedToRefresh)
void
setName(String name)
void
setRecordCreateTimeMs(Long recordCreateTimeMs)
void
setRefreshToken(String refreshToken)
-
Methods inherited from class jetbrains.buildServer.connections.ExpiringAccessTokenImpl
getAccessToken, getCreateTimeMs, getTimeToLiveMs, isExpired, isExpiring, isValid
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.connections.AccessToken
getAccessToken
-
Methods inherited from interface jetbrains.buildServer.connections.ExpiringAccessToken
getCreateTimeMs, getTimeToLiveMs, isExpired, isExpiring, isValid
-
-
-
-
Method Detail
-
getScope
@NotNull public String getScope()
- Specified by:
getScope
in interfaceRefreshableTokenData
- Returns:
- token scope in the third party system as a string
-
getAccessibleEntities
@Nullable public Set<String> getAccessibleEntities()
Description copied from interface:RefreshableTokenData
A token could be not only limited by its scope, but also by the entities that can be accessed with it, such as repositories for example- Specified by:
getAccessibleEntities
in interfaceRefreshableTokenData
- Returns:
- a set of ids or names of such entities, if null no such restrictions apply
-
setAccessibleEntities
public void setAccessibleEntities(@Nullable Collection<String> accessibleEntities)
Description copied from interface:RefreshableTokenData
Sets accessible entities- Specified by:
setAccessibleEntities
in interfaceRefreshableTokenData
- Parameters:
accessibleEntities
- a collection of ids or names of entities that can be accessed with the token, null if no such restrictions apply
-
isAllowedForEntity
public boolean isAllowedForEntity(String entityId)
- Specified by:
isAllowedForEntity
in interfaceRefreshableTokenData
- Parameters:
entityId
- entity id or name- Returns:
- true if the token is explicitly permitted to access this entity or if it has no such restrictions
-
getOauthLogin
@NotNull public String getOauthLogin()
- Specified by:
getOauthLogin
in interfaceRefreshableTokenData
- Returns:
- third party system username associated with the token.
-
getTimeToLiveSeconds
public int getTimeToLiveSeconds()
- Specified by:
getTimeToLiveSeconds
in interfaceRefreshableTokenData
- Returns:
- token's TTL in seconds
-
isPermanent
public boolean isPermanent()
- Specified by:
isPermanent
in interfaceRefreshableTokenData
- Returns:
- true if token is permanent and never expires, false otherwise
-
getCreateDate
@NotNull public Date getCreateDate()
- Specified by:
getCreateDate
in interfaceRefreshableTokenData
- Returns:
- token's creation time
-
getTeamCityUserId
public long getTeamCityUserId()
- Specified by:
getTeamCityUserId
in interfaceRefreshableTokenData
- Returns:
- teamcity user id associated with the token, a negative value if the token is non-personal
-
getRefreshToken
@Nullable public String getRefreshToken()
- Specified by:
getRefreshToken
in interfaceRefreshableTokenData
- Returns:
- refresh token if available, null otherwise
-
setRefreshToken
public void setRefreshToken(@NotNull String refreshToken)
-
addContextKey
public void addContextKey(@NotNull String contextKey)
Description copied from interface:RefreshableTokenData
Adds a context key to the set of allowed context keys- Specified by:
addContextKey
in interfaceRefreshableTokenData
-
removeContextKey
public void removeContextKey(@NotNull String contextKey)
Description copied from interface:RefreshableTokenData
Removes a context key from the set of allowed context keys- Specified by:
removeContextKey
in interfaceRefreshableTokenData
-
getContextKeys
@NotNull public Set<String> getContextKeys()
- Specified by:
getContextKeys
in interfaceRefreshableTokenData
- Returns:
- all context keys defining applicability of the token
-
addContextKeys
public void addContextKeys(@Nullable Collection<String> contextKeys)
Description copied from interface:RefreshableTokenData
Adds context keys defining where the token is applicable- Specified by:
addContextKeys
in interfaceRefreshableTokenData
- Parameters:
contextKeys
- context keys collection or null if the token is supposed to be applicable everywhere
-
getRecordCreateTimeMs
@Nullable public Long getRecordCreateTimeMs()
Description copied from interface:RefreshableTokenData
This returns the logical creation timestamp of the token record. This means the first time this particular token record was initially persisted. The value will not change even if the token is refreshed / replaced.- Specified by:
getRecordCreateTimeMs
in interfaceRefreshableTokenData
- Returns:
- the timestamp of the logical token record's creation in milliseconds since the epoch, or null if the value isn't known
-
setRecordCreateTimeMs
public void setRecordCreateTimeMs(@Nullable Long recordCreateTimeMs)
-
getName
@Nullable public String getName()
- Specified by:
getName
in interfaceRefreshableTokenData
- Returns:
- the user-assigned token name or null if none
-
setName
public void setName(@Nullable String name)
-
getFailedToRefresh
@Nullable public Boolean getFailedToRefresh()
- Specified by:
getFailedToRefresh
in interfaceRefreshableTokenData
- Returns:
- optional marker if this token has been flagged as failing to refresh in the past
-
setFailedToRefresh
public void setFailedToRefresh(@Nullable Boolean failedToRefresh)
-
-