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