wildfly-security/wildfly-elytron — pull request #15 by darranl (2014-07-27 17:37:21+00:00)
Title: ELY-26 Add notion of a pre-authentication identity.

The API/SPI currently has the notion of a post-authentication SecurityIdentity, this change introduces a pre-authentication identity.

The current SecurityRealm API is stateless, the down side of that however is that it requires a Principal instance to be passed in on each call that is specific to an identity, this then imposes a requirement that the Principal is created early. We also need to support principals that originate outside the realm although this specific pull request does not eliminate that.

At the moment I have taken the decision to use an interface for the RealmIdentity, this allows the realms to supply their own implementations. As this identity instance is owned by the realm it also allows the realm to use it to start to build up what it knows about the identity without mandating a specific call order.

Currently it is not suitable to reference anything from the RealmIdentity that would need clean up but for items that can be collected during normal garbage collection it does effectively offer some state caching for the duration of an authentication request without resorting to more complex cache implementations.

Anyway, overall this is just a general proposal for how we can solve it so we can discuss it next week.