What is an LTPA token? – the short answer
When a client connects to a web server and logs on (for example with a userid and password), the server can send back a cookie containing encrypted logon information.
When the client sends this cookie in the next request, the server decrypts it, and so shortens the logon process. Eventually the token will expire and the client will need to logon again.
What is an LTPA token? – a longer answer.
There is a long (perhaps too long) description of LTPA here.
The Lightweight Third-Party Authentication says When accessing web servers that use the LTPA technology it is possible for a web user to re-use their login across physical servers.
The server has an encryption key which it uses to encrypt the “reuse” content. This key could change every time the server start, in fact it is good practice to change the key “often”.
For Liberty the information is configured in the <ltpa…/> tag. See Configuring LTPA in Liberty.
If a client has an LTPA2 token, and the server restarts, if they encryption keys are the same as before, the LTPA2 will be accepted (providing it hasn’t expired). If they encryption key has changed, the client will need to logon to get a new LTPA.
How to configure LTPA?
The ltpa tag in server.xml looks like
<ltpa keysFileName="yourLTPAKeysFileName.keys"
keysPassword="keysPassword"
expiration="120" />
Where
- keysFileName defaults to ${server.output.dir}/resources/security/ltpa.keys Note: This is a file, not a keyring.
- expiration defaults to 120 minutes.
Often password or key data is just base64 encoded, so it trivial to decode. You can encrypt these using the Liberty securityUtility command. The createLTPAKeys option creates a set of LTPA keys for use by the server, or that can be shared with multiple servers. If no server or file is specified, an ltpa.keys file is created in the current working directory.
Single server mode
If the web server is isolated and has its own encryption key then the LTPA can be passed to the server. It can use its encryption key to decrypt the userid information and use it.
If you try to use the LTPA on another web server, which has a different encryption key, the decryption will fail, and the LTPA cannot be used.
Sharing an encryption key
If multiple web servers share the same key, then the LTPA can be used on those servers. For example, you have multiple back-end servers for availability, and a work request can be routed to any server. Once the client has logged on and got the LTPA, future requests can be routed to any of the servers, without the need to logon. The LTPA can be decrypted because of the shared key.
Does this give a different access?
If MQWEB and z/OSMF share the same encryption key, a client logs on to MQWEB and gets a LTPA. The client then uses the LTPA to logon to z/OSMF. All this does is replace the userid and password. MQWEB and z/OSMF still have to determine what permissions the userid has. LTPA does not affect the access.
What happens when the LTPA expires?
Using CURL to send a request to MQWEB with an expired LTPA, I got
< HTTP/2 401
...
* Replaced cookie LtpaToken2_8443="""" for domain 10.1.1.2, path /, expire 786297600
< set-cookie: LtpaToken2_8443=""; Expires=Thu, 01 Dec 1994 16:00:00 GMT; Path=/; Secure; HttpOnly
* Added cookie LtpaToken2_8443="""" for domain 10.1.1.2, path /, expire 786297600
< set-cookie: LtpaToken2_8443=""; Expires=Thu, 01 Dec 1994 16:00:00 GMT; Path=/; Secure; HttpOnly
* Added cookie LtpaToken2_8443="""" for domain 10.1.1.2, path /, expire 786297600
< set-cookie: LtpaToken2_8443=""; Expires=Thu, 01 Dec 1994 16:00:00 GMT; Path=/; Secure; HttpOnly
...
{"error": [{
"msgId": "MQWB0112E",
"action": "Login to the REST API to obtain a valid authentication cookie.",
"completionCode": 0,
"reasonCode": 0,
"type": "rest",
"message": "MQWB0112E: The 'LtpaToken2_8443' authentication token cookie failed verification.",
"explanation": "The REST API request cannot be completed because the authentication token failed verification."
Where MQ uses the token name LtpaToken2_${httpsPort}, and so has the https port in it.
Because the Ltpa token had expired, a null token was stored in the cookie.
MQ returned a message giving an explanation. Each product will be different.
Tracing LTPA2
Using a LTPA2 token.
I had problems with LTPA2 – I thought an LTPA2 token would expire – but it continued to work.
A Liberty trace with
com.ibm.ws.security.token.ltpa.internal.LTPAToken2=finest
gave me a lot more data which was not useful – but it did give me
LTPAToken2 3 Current time = Wed Aug 27 17:21:31 GMT 2025, expiration time = Wed Aug 27 19:16:23 GMT 2025
This shows the LTPA was valid from 17:21 to 19:16 or 115 minutes remaining.
Logging on and creating a LTPA token
With
com.ibm.ws.security.token.ltpa.internal.LTPAToken2=finer
I got lots of data including
00000055 LTPAToken2 > <init> Entry
user:ADCDPL/COLIN
120
Which shows the userid, and the expiry interval in minutes
When the LTPA had expired
Current time = Thu Aug 28 06:51:35 GMT 2025, expiration time = Wed Aug 27 19:42:20 GMT 2025
The token has expired: current time = Thu Aug 28 06:51:35 GMT 2025, expire time = Wed Aug 27 19:42:20 GMT 2025.