use of fish.payara.security.annotations.PamIdentityStoreDefinition in project Payara by payara.
the class RealmExtension method findPamIdentityStoreDefinitions.
/**
* Find the
* {@link PamIdentityStoreDefinition} & {@link PamIdentityStoreDefinitions}
* annotation.
*
* @param <T>
* @param eventIn
* @param beanManager
*/
private <T> void findPamIdentityStoreDefinitions(BeanManager beanManager, ProcessBean<T> event, Class<?> beanClass) {
// get the identity store from the annotation (if it exists)
Optional<PamIdentityStoreDefinition> optionalStore = getAnnotation(beanManager, event.getAnnotated(), PamIdentityStoreDefinition.class);
optionalStore.ifPresent(definition -> {
validateDefinition(definition.value(), PamRealmIdentityStore.REALM_CLASS, definition.jaasContext());
logActivatedIdentityStore(PamRealmIdentityStore.class, beanClass);
PamRealmIdentityStoreConfiguration configuration = PamRealmIdentityStoreConfiguration.from(definition);
Properties props = new Properties();
props.put(JAAS_CONTEXT, configuration.getJaasContext());
createRealm(configuration, PamRealmIdentityStore.REALM_CLASS, PamRealmIdentityStore.REALM_LOGIN_MODULE_CLASS, props);
identityStoreBeans.add(new CdiProducer<IdentityStore>().scope(ApplicationScoped.class).beanClass(IdentityStore.class).types(Object.class, IdentityStore.class).addToId(PamRealmIdentityStore.class).create(e -> {
PamRealmIdentityStore mechanism = CDI.current().select(PamRealmIdentityStore.class).get();
mechanism.init(configuration);
return mechanism;
}));
});
}
Aggregations