pzampino opened a new pull request #345:
URL: https://github.com/apache/knox/pull/345


   ## What changes were proposed in this pull request?
   
   With the resolution of KNOX-2375, the potential for token state to be lost 
between the issuance of a token and its persistence to the keystore. To address 
this risk, this patchset introduces a TokenStateJournal, the default 
implementation of which persists small individual files for each token's state 
until it is persisted in the keystore. This new facility has been integrated 
into the AliasBasedTokenStateService, which is the driver behind creating it. 
When token state it added, an entry (file) is added to the journal; Then, once 
that state has been persisted in the keystore, the journal entry (file) is 
removed since the risk of loss is no longer present.
   
   Part of the integration includes loading all the persisted token state 
journal entries when the AliasBasedTokenStateService is initialized, which 
effectively allows it to resume processing from where it has left off if the 
gateway was stopped or crashed after the addition of one or more tokens but 
before the state for those tokens could be persisted.
   
   ## How was this patch tested?
   
   - 'mvn -T1.5C -Ppackage,release clean install'
   - Added FileTokenStateJournalTest and MultiFileTokenStateJournalTest unit 
test classes
   - Augmented AliasBasedTokenStateServiceTest to test the integration of the 
TokenStateJournal with the AliasBasedTokenStateService, the intended (and only) 
consumer.
   - Manual testing involving two clients concurrently requesting tokens, and 
allowing this type of test to run through multiple token state eviction cycles, 
such that I feel there is no additional issue wrt thread-safety or performance.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to