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