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 voidaddContextKey(String contextKey)Adds a context key to the set of allowed context keysvoidaddContextKeys(Collection<String> contextKeys)Adds context keys defining where the token is applicablebooleanequals(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()DategetCreateDate()BooleangetFailedToRefresh()StringgetName()StringgetOauthLogin()LonggetRecordCreateTimeMs()This returns the logical creation timestamp of the token record.StringgetRefreshToken()StringgetScope()longgetTeamCityUserId()intgetTimeToLiveSeconds()inthashCode()booleanisAllowedForEntity(String entityId)booleanisPermanent()voidremoveContextKey(String contextKey)Removes a context key from the set of allowed context keysvoidsetAccessibleEntities(Collection<String> accessibleEntities)Sets accessible entitiesvoidsetFailedToRefresh(Boolean failedToRefresh)voidsetName(String name)voidsetRecordCreateTimeMs(Long recordCreateTimeMs)voidsetRefreshToken(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:
getScopein interfaceRefreshableTokenData- Returns:
- token scope in the third party system as a string
-
getAccessibleEntities
@Nullable public Set<String> getAccessibleEntities()
Description copied from interface:RefreshableTokenDataA 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:
getAccessibleEntitiesin 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:RefreshableTokenDataSets accessible entities- Specified by:
setAccessibleEntitiesin 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:
isAllowedForEntityin 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:
getOauthLoginin interfaceRefreshableTokenData- Returns:
- third party system username associated with the token.
-
getTimeToLiveSeconds
public int getTimeToLiveSeconds()
- Specified by:
getTimeToLiveSecondsin interfaceRefreshableTokenData- Returns:
- token's TTL in seconds
-
isPermanent
public boolean isPermanent()
- Specified by:
isPermanentin interfaceRefreshableTokenData- Returns:
- true if token is permanent and never expires, false otherwise
-
getCreateDate
@NotNull public Date getCreateDate()
- Specified by:
getCreateDatein interfaceRefreshableTokenData- Returns:
- token's creation time
-
getTeamCityUserId
public long getTeamCityUserId()
- Specified by:
getTeamCityUserIdin 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:
getRefreshTokenin 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:RefreshableTokenDataAdds a context key to the set of allowed context keys- Specified by:
addContextKeyin interfaceRefreshableTokenData
-
removeContextKey
public void removeContextKey(@NotNull String contextKey)Description copied from interface:RefreshableTokenDataRemoves a context key from the set of allowed context keys- Specified by:
removeContextKeyin interfaceRefreshableTokenData
-
getContextKeys
@NotNull public Set<String> getContextKeys()
- Specified by:
getContextKeysin interfaceRefreshableTokenData- Returns:
- all context keys defining applicability of the token
-
addContextKeys
public void addContextKeys(@Nullable Collection<String> contextKeys)Description copied from interface:RefreshableTokenDataAdds context keys defining where the token is applicable- Specified by:
addContextKeysin 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:RefreshableTokenDataThis 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:
getRecordCreateTimeMsin 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:
getNamein 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:
getFailedToRefreshin interfaceRefreshableTokenData- Returns:
- optional marker if this token has been flagged as failing to refresh in the past
-
setFailedToRefresh
public void setFailedToRefresh(@Nullable Boolean failedToRefresh)
-
-