Class Ltpa2Token
java.lang.Object
de.sephirothj.spring.security.ltpa2.Ltpa2Token
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetAttribute(@NonNull String attribute) get the value of the specified attributebooleanchecks if this token is expiredstatic @NonNull Ltpa2Tokencreates a new instance out of serialized (tokenized) tokenvoidsets the expiration of the tokenvoidsetExpire(@NonNull LocalDateTime expire) sets the expiration of the tokenvoidsets the user of the tokentoString()gets the token as serialized (tokenized) string@NonNull Ltpa2TokenwithAttribute(@NonNull String attribute, @NonNull 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
-
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
-