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