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 class
Token.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 int
compareTo(Token o)
String
describe(boolean verbose)
boolean
equals(Object o)
Date
getCreationTime()
Date
getExpirationTime()
String
getIdentifier()
String
getName()
long
getOwnerId()
AuthenticationToken.PermissionsRestriction
getPermissionsRestriction()
Token.TokenLastAccessInfo
getTokenLastAccessInfo()
String
getValue()
int
hashCode()
boolean
isConsistent(SUser user)
Check for internal consistence of permission restrictions with token owner permissionsvoid
setTokenLastAccessInfo(String lastAccessRemoteAddress)
Sets last access IP address with last access date in pairstatic void
validateName(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:
getOwnerId
in interfaceAuthenticationToken
- Returns:
- id of the user owning this token
-
getIdentifier
@NotNull public String getIdentifier()
- Specified by:
getIdentifier
in interfaceParsedToken
-
getValue
@NotNull public String getValue()
- Specified by:
getValue
in interfaceParsedToken
-
getName
@NotNull public String getName()
- Specified by:
getName
in interfaceAuthenticationToken
- Returns:
- name of the token
-
getCreationTime
@NotNull public Date getCreationTime()
- Specified by:
getCreationTime
in interfaceAuthenticationToken
- Returns:
- date when this token was created
-
getExpirationTime
@NotNull public Date getExpirationTime()
- Specified by:
getExpirationTime
in interfaceAuthenticationToken
- Returns:
- date when this token will expire
-
getTokenLastAccessInfo
@NotNull public Token.TokenLastAccessInfo getTokenLastAccessInfo()
- Specified by:
getTokenLastAccessInfo
in interfaceAuthenticationToken
- Returns:
- information about lats usage of this token
-
setTokenLastAccessInfo
public void setTokenLastAccessInfo(@Nullable String lastAccessRemoteAddress)
Description copied from interface:AuthenticationToken
Sets last access IP address with last access date in pair- Specified by:
setTokenLastAccessInfo
in interfaceAuthenticationToken
- Parameters:
lastAccessRemoteAddress
- IP address associated with last usage of this token
-
compareTo
public int compareTo(@NotNull Token o)
- Specified by:
compareTo
in interfaceComparable<Token>
-
validateName
public static void validateName(@NotNull String name)
-
getPermissionsRestriction
@Nullable public AuthenticationToken.PermissionsRestriction getPermissionsRestriction()
- Specified by:
getPermissionsRestriction
in 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:AuthenticationToken
Check for internal consistence of permission restrictions with token owner permissions- Specified by:
isConsistent
in interfaceAuthenticationToken
- Parameters:
user
-SUser
owner 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
-
-