2.2.2. Defining a Custom Scope
The
Identity
bean can be also configured to use a specific scope, depending on your requirements. For example, Apache DeltaSpike features a WindowScoped
, a normal passivating scope. It makes sense to want to have a window scoped identity to enable a user-per-window application (like Google does).
In order to specify the
Identity
bean scope you just need a configuration as follows:
public class SecurityConfiguration { public void init(@Observes SecurityConfigurationEvent event) { SecurityConfigurationBuilder securityConfigurationBuilder = event.getBuilder(); securityConfigurationBuilder .identity() .scope(WindowScoped.class); } }
Note
When specifying a scope make sure it is a
NormalScope
and not a pseudo-scope.