use of fish.payara.security.annotations.RealmIdentityStoreDefinitions in project Payara by payara.
the class RealmExtension method findRealmIdentityStoreDefinitions.
/**
* Find the
* {@link RealmIdentityStoreDefinition} & {@link RealmIdentityStoreDefinitions}
* annotation.
*
* @param <T>
* @param eventIn
* @param beanManager
*/
private <T> void findRealmIdentityStoreDefinitions(BeanManager beanManager, ProcessBean<T> event, Class<?> beanClass) {
// get the identity store from the annotation (if it exists)
Optional<RealmIdentityStoreDefinition> optionalStore = getAnnotation(beanManager, event.getAnnotated(), RealmIdentityStoreDefinition.class);
optionalStore.ifPresent(definition -> {
validateDefinition(definition);
logActivatedIdentityStore(RealmIdentityStore.class, beanClass);
identityStoreBeans.add(new CdiProducer<IdentityStore>().scope(ApplicationScoped.class).beanClass(IdentityStore.class).types(Object.class, IdentityStore.class).addToId(RealmIdentityStore.class + "-" + definition.value()).create(e -> {
RealmIdentityStore mechanism = CDI.current().select(RealmIdentityStore.class).get();
mechanism.setConfiguration(definition);
return mechanism;
}));
});
// get the identity store from the annotation (if it exists)
Optional<RealmIdentityStoreDefinitions> optionalStores = getAnnotation(beanManager, event.getAnnotated(), RealmIdentityStoreDefinitions.class);
optionalStores.ifPresent(definitions -> {
for (RealmIdentityStoreDefinition definition : definitions.value()) {
validateDefinition(definition);
logActivatedIdentityStore(RealmIdentityStore.class, beanClass);
identityStoreBeans.add(new CdiProducer<IdentityStore>().scope(ApplicationScoped.class).beanClass(IdentityStore.class).types(Object.class, IdentityStore.class).addToId(RealmIdentityStore.class + "-" + definition.value()).create(e -> {
RealmIdentityStore mechanism = CDI.current().select(RealmIdentityStore.class).get();
mechanism.setConfiguration(definition);
return mechanism;
}));
}
});
}
Aggregations