Extending token support
IBM® WebSphere® sMash's authentication provides a pluggable token handling framework to support custom token implementations.
Implement a token service handler
For each of the following event names, implement a handler:
- <tokenType>Attach
- Creates a new token
- <tokenType>Validate
- Validates a token
- <tokenType>Logout
- Handles the logout of a user
zero.config file as a handler for those events. For example, if your tokenType is customToken, you would implement a handler with the following methods: - onCustomTokenAttach
- Creates a new CustomToken token
- onCustomTokenValidate
- Validates a CustomToken token
- onCustomTokenLogout
- Handle logout processing
CustomToken in the application or library zero.config file:
/config/security/token/tokenType="customToken"
/config/handlers += [{
"events" : ["customTokenAttach", "customTokenValidate",
"customTokenLogout"],
"handler" : "custom.CustomTokenService.class"
}]
The token type must be set in the GlobalContext at /config/security/token/tokenType.