Interface RefreshableTokenData
-
- All Superinterfaces:
AccessToken
,ExpiringAccessToken
- All Known Subinterfaces:
RefreshableToken
- All Known Implementing Classes:
OAuthToken
,RefreshableTokenDataImpl
,RefreshableTokenImpl
public interface RefreshableTokenData extends ExpiringAccessToken
Refreshable token
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.connections.AccessToken
TOKEN_ID_PREFIX
-
-
Method Summary
All Methods Instance Methods Abstract 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 applicableSet<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()
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 entities-
Methods inherited from interface jetbrains.buildServer.connections.AccessToken
getAccessToken
-
Methods inherited from interface jetbrains.buildServer.connections.ExpiringAccessToken
getCreateTimeMs, getTimeToLiveMs, isExpired, isExpiring, isValid
-
-
-
-
Method Detail
-
getRefreshToken
@Nullable String getRefreshToken()
- Returns:
- refresh token if available, null otherwise
-
addContextKey
void addContextKey(@NotNull String contextKey)
Adds a context key to the set of allowed context keys- Parameters:
contextKey
-
-
removeContextKey
void removeContextKey(@NotNull String contextKey)
Removes a context key from the set of allowed context keys- Parameters:
contextKey
-
-
getContextKeys
@NotNull Set<String> getContextKeys()
- Returns:
- all context keys defining applicability of the token
-
addContextKeys
void addContextKeys(@Nullable Collection<String> contextKeys)
Adds context keys defining where the token is applicable- Parameters:
contextKeys
- context keys collection or null if the token is supposed to be applicable everywhere
-
getScope
@NotNull String getScope()
- Returns:
- token scope in the third party system as a string
-
getAccessibleEntities
@Nullable 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 example- Returns:
- a set of ids or names of such entities, if null no such restrictions apply
-
setAccessibleEntities
void setAccessibleEntities(@Nullable Collection<String> accessibleEntities)
Sets accessible entities- Parameters:
accessibleEntities
- a collection of ids or names of entities that can be accessed with the token, null if no such restrictions apply
-
isAllowedForEntity
boolean isAllowedForEntity(String entityId)
- 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 String getOauthLogin()
- Returns:
- third party system username associated with the token.
-
getTimeToLiveSeconds
int getTimeToLiveSeconds()
- Returns:
- token's TTL in seconds
-
isPermanent
boolean isPermanent()
- Returns:
- true if token is permanent and never expires, false otherwise
-
getCreateDate
@NotNull Date getCreateDate()
- Returns:
- token's creation time
-
getTeamCityUserId
long getTeamCityUserId()
- Returns:
- teamcity user id associated with the token, a negative value if the token is non-personal
-
getRecordCreateTimeMs
@Nullable Long getRecordCreateTimeMs()
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.- Returns:
- the timestamp of the logical token record's creation in milliseconds since the epoch, or null if the value isn't known
- Since:
- 2024.07
-
getName
@Nullable String getName()
- Returns:
- the user-assigned token name or null if none
-
getFailedToRefresh
@Nullable Boolean getFailedToRefresh()
- Returns:
- optional marker if this token has been flagged as failing to refresh in the past
- Since:
- 2024.07
-
-