Class Ltpa2Token
java.lang.Object
de.sephirothj.spring.security.ltpa2.Ltpa2Token
Represents an LTPA2-Token
- Author:
- Sephiroth
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String attribute) get the value of the specified attributeboolean
checks if this token is expiredstatic Ltpa2Token
creates a new instance out of serialized (tokenized) tokenvoid
sets the expiration of the tokenvoid
setExpire
(LocalDateTime expire) sets the expiration of the tokenvoid
sets the user of the tokentoString()
gets the token as serialized (tokenized) stringwithAttribute
(String attribute, String value) sets an attribute
-
Field Details
-
USER_ATTRIBUTE_NAME
the well-known name for the attribute containing the username- See Also:
-
EXPIRE_ATTRIBUTE_NAME
the well-known name for the attribute containing the expiration- See Also:
-
-
Constructor Details
-
Ltpa2Token
public Ltpa2Token()
-
-
Method Details
-
setExpire
sets the expiration of the token- Parameters:
expire
- the (new) expiration date
-
setExpire
sets the expiration of the token- Parameters:
expire
- the (new) expiration date in milliseconds since 01.01.1970T00:00:00Z
-
isExpired
public boolean isExpired()checks if this token is expired- Returns:
- whether the token is expired or not
-
setUser
sets the user of the token- Parameters:
user
- the (new) user DN
-
getAttribute
get the value of the specified attribute
known attributes:
- u: same as
user
- expire:
expire
- host
- port
- java.naming.provider.url
- process.serverName
- security.authMechOID
- type
- Parameters:
attribute
- the name of the attribute- Returns:
- attribute value. may be
null
- u: same as
-
withAttribute
sets an attribute- Parameters:
attribute
- the name of the attributevalue
- attribute value- Returns:
- this instance for chaining
-
toString
gets the token as serialized (tokenized) string -
of
creates a new instance out of serialized (tokenized) token- Parameters:
serializedToken
- a serialized LTPA2 token (unencrypted)- Returns:
- new instance
- Throws:
IllegalArgumentException
- if the given token is empty
-