| | |
|
|
|
Extending token support
Project Zero's authentication provides a pluggable token handling framework to support custom token implementations. The following sections of this article describe how token support can be extended:
Token and TokenFactory interfaces
To implement a custom token, first create instances of the Token and TokenFactory interfaces. For more information on each, see the following information:
- Token
- zero.core.security.token.Token
- TokenFactory
- zero.core.security.token.TokenFactory
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
The details of the <tokenType> token are described in the following section. You can register the handler in your library or in the application's 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
The following example shows the settings for configuring a custom token named 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.
|
|
r9 - 29 Jan 2008 - 18:19:39 - todkap
|
|
|
| | |