Class Token
- java.lang.Object
-
- jetbrains.buildServer.serverSide.auth.impl.Token
-
- All Implemented Interfaces:
Comparable<Token>,Loggable,AuthenticationToken,ParsedToken
public class Token extends Object implements Comparable<Token>, AuthenticationToken, Loggable
- Author:
- Dmitrii Bogdanov
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classToken.TokenLastAccessInfo-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.auth.AuthenticationToken
AuthenticationToken.LastAccessInfo, AuthenticationToken.PermissionsRestriction
-
-
Constructor Summary
Constructors Constructor Description Token(long ownerId, String identifier, String name, String value, Date creationTime, Date expirationTime)Token(long ownerId, String identifier, String name, String value, Date creationTime, Date expirationTime, Date lastAccessTime, String lastAccessRemoteAddress, AuthenticationToken.PermissionsRestriction permissionsRestriction)Token(long ownerId, String identifier, String name, String value, Date creationTime, Date expirationTime, AuthenticationToken.PermissionsRestriction permissionsRestriction)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Token o)Stringdescribe(boolean verbose)booleanequals(Object o)DategetCreationTime()DategetExpirationTime()StringgetIdentifier()StringgetName()longgetOwnerId()AuthenticationToken.PermissionsRestrictiongetPermissionsRestriction()Token.TokenLastAccessInfogetTokenLastAccessInfo()StringgetValue()inthashCode()booleanisConsistent(SUser user)Check for internal consistence of permission restrictions with token owner permissionsvoidsetTokenLastAccessInfo(String lastAccessRemoteAddress)Sets last access IP address with last access date in pairstatic voidvalidateName(String name)
-
-
-
Constructor Detail
-
Token
public Token(long ownerId, @NotNull String identifier, @NotNull String name, @NotNull String value, @NotNull Date creationTime, @Nullable Date expirationTime)
-
Token
public Token(long ownerId, @NotNull String identifier, @NotNull String name, @NotNull String value, @NotNull Date creationTime, @NotNull Date expirationTime, @Nullable AuthenticationToken.PermissionsRestriction permissionsRestriction)
-
Token
public Token(long ownerId, @NotNull String identifier, @NotNull String name, @NotNull String value, @NotNull Date creationTime, @Nullable Date expirationTime, @Nullable Date lastAccessTime, @Nullable String lastAccessRemoteAddress, @Nullable AuthenticationToken.PermissionsRestriction permissionsRestriction)
-
-
Method Detail
-
getOwnerId
public long getOwnerId()
- Specified by:
getOwnerIdin interfaceAuthenticationToken- Returns:
- id of the user owning this token
-
getIdentifier
@NotNull public String getIdentifier()
- Specified by:
getIdentifierin interfaceParsedToken
-
getValue
@NotNull public String getValue()
- Specified by:
getValuein interfaceParsedToken
-
getName
@NotNull public String getName()
- Specified by:
getNamein interfaceAuthenticationToken- Returns:
- name of the token
-
getCreationTime
@NotNull public Date getCreationTime()
- Specified by:
getCreationTimein interfaceAuthenticationToken- Returns:
- date when this token was created
-
getExpirationTime
@NotNull public Date getExpirationTime()
- Specified by:
getExpirationTimein interfaceAuthenticationToken- Returns:
- date when this token will expire
-
getTokenLastAccessInfo
@NotNull public Token.TokenLastAccessInfo getTokenLastAccessInfo()
- Specified by:
getTokenLastAccessInfoin interfaceAuthenticationToken- Returns:
- information about lats usage of this token
-
setTokenLastAccessInfo
public void setTokenLastAccessInfo(@Nullable String lastAccessRemoteAddress)Description copied from interface:AuthenticationTokenSets last access IP address with last access date in pair- Specified by:
setTokenLastAccessInfoin interfaceAuthenticationToken- Parameters:
lastAccessRemoteAddress- IP address associated with last usage of this token
-
compareTo
public int compareTo(@NotNull Token o)- Specified by:
compareToin interfaceComparable<Token>
-
validateName
public static void validateName(@NotNull String name)
-
getPermissionsRestriction
@Nullable public AuthenticationToken.PermissionsRestriction getPermissionsRestriction()
- Specified by:
getPermissionsRestrictionin interfaceAuthenticationToken- Returns:
- null if this token should have same permissions as the owner. If not null - token will have only the intersection of permissions from owner and the limit.
-
isConsistent
public boolean isConsistent(@NotNull SUser user)Description copied from interface:AuthenticationTokenCheck for internal consistence of permission restrictions with token owner permissions- Specified by:
isConsistentin interfaceAuthenticationToken- Parameters:
user-SUserowner of the token- Returns:
- false if permission restriction has permissions that are not assigned to user or if the user is not the owner of the token
-
-