From 936d786216eba218aa108e7784d5cb0db44fe6cb Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Mon, 17 Oct 2022 16:50:04 +0200 Subject: [PATCH] ELYEE-30 Change bean class of produced beans --- .../security/soteria/original/CdiExtension.java | 13 ------------- .../security/soteria/original/CdiProducer.java | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/security/src/main/java/org/wildfly/security/soteria/original/CdiExtension.java b/security/src/main/java/org/wildfly/security/soteria/original/CdiExtension.java index de868fc2b..3b9c05c0b 100644 --- a/security/src/main/java/org/wildfly/security/soteria/original/CdiExtension.java +++ b/security/src/main/java/org/wildfly/security/soteria/original/CdiExtension.java @@ -121,7 +121,6 @@ public void processBean(@Observes ProcessBean eventIn, BeanManager beanMa identityStoreBeans.add(new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(IdentityStore.class) .types(Object.class, IdentityStore.class, EmbeddedIdentityStore.class) .addToId(EmbeddedIdentityStoreDefinition.class) .create(e -> new EmbeddedIdentityStore(embeddedIdentityStoreDefinition)) @@ -134,7 +133,6 @@ public void processBean(@Observes ProcessBean eventIn, BeanManager beanMa identityStoreBeans.add(new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(IdentityStore.class) .types(Object.class, IdentityStore.class, DatabaseIdentityStore.class) .addToId(DatabaseIdentityStoreDefinition.class) .create(e -> new DatabaseIdentityStore( @@ -149,7 +147,6 @@ public void processBean(@Observes ProcessBean eventIn, BeanManager beanMa identityStoreBeans.add(new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(IdentityStore.class) .types(Object.class, IdentityStore.class, LdapIdentityStore.class) .addToId(LdapIdentityStoreDefinition.class) .create(e -> new LdapIdentityStore( @@ -164,7 +161,6 @@ public void processBean(@Observes ProcessBean eventIn, BeanManager beanMa authenticationMechanismBean = new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(BasicAuthenticationMechanism.class) .types(Object.class, HttpAuthenticationMechanism.class, BasicAuthenticationMechanism.class) .addToId(BasicAuthenticationMechanismDefinition.class) .create(e -> new BasicAuthenticationMechanism( @@ -178,7 +174,6 @@ public void processBean(@Observes ProcessBean eventIn, BeanManager beanMa authenticationMechanismBean = new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(HttpAuthenticationMechanism.class) .types(Object.class, HttpAuthenticationMechanism.class) .addToId(FormAuthenticationMechanismDefinition.class) .create(e -> { @@ -197,7 +192,6 @@ public void processBean(@Observes ProcessBean eventIn, BeanManager beanMa authenticationMechanismBean = new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(HttpAuthenticationMechanism.class) .types(Object.class, HttpAuthenticationMechanism.class) .addToId(CustomFormAuthenticationMechanismDefinition.class) .create(e -> { @@ -218,14 +212,12 @@ public void processBean(@Observes ProcessBean eventIn, BeanManager beanMa authenticationMechanismBean = new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(HttpAuthenticationMechanism.class) .types(HttpAuthenticationMechanism.class) .addToId(OpenIdAuthenticationMechanism.class) .create(e -> getBeanReference(OpenIdAuthenticationMechanism.class)); identityStoreBeans.add(new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(IdentityStore.class) .types(IdentityStore.class) .addToId(OpenIdIdentityStore.class) .create(e -> getBeanReference(OpenIdIdentityStore.class)) @@ -233,7 +225,6 @@ public void processBean(@Observes ProcessBean eventIn, BeanManager beanMa extraBeans.add(new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(OpenIdAuthenticationMechanismDefinition.class) .types(OpenIdAuthenticationMechanismDefinition.class) .addToId("OpenId Definition") .create(e -> definition) @@ -267,7 +258,6 @@ public void afterBean(final @Observes AfterBeanDiscovery afterBeanDiscovery, Bea if ("basic".equalsIgnoreCase(loginConfig.getAuthMethod())) { authenticationMechanismBean = new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(BasicAuthenticationMechanism.class) .types(Object.class, HttpAuthenticationMechanism.class, BasicAuthenticationMechanism.class) .addToId(BasicAuthenticationMechanismDefinition.class) .create(e -> @@ -278,7 +268,6 @@ public void afterBean(final @Observes AfterBeanDiscovery afterBeanDiscovery, Bea } else if ("form".equalsIgnoreCase(loginConfig.getAuthMethod())) { authenticationMechanismBean = new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(HttpAuthenticationMechanism.class) .types(Object.class, HttpAuthenticationMechanism.class) .addToId(FormAuthenticationMechanismDefinition.class) .create(e -> { @@ -314,7 +303,6 @@ public void afterBean(final @Observes AfterBeanDiscovery afterBeanDiscovery, Bea // Probably can circumvent this using programmatic lookup or Instance injection afterBeanDiscovery.addBean() .scope(Dependent.class) - .beanClass(OpenIdAuthenticationMechanismDefinition.class) .types(OpenIdAuthenticationMechanismDefinition.class) .id("Null OpenId Definition") .createWith(cc -> null); @@ -324,7 +312,6 @@ public void afterBean(final @Observes AfterBeanDiscovery afterBeanDiscovery, Bea decorator.decorateBean( new CdiProducer() .scope(ApplicationScoped.class) - .beanClass(IdentityStoreHandler.class) .types(Object.class, IdentityStoreHandler.class) .addToId(IdentityStoreHandler.class) .create(e -> { diff --git a/security/src/main/java/org/wildfly/security/soteria/original/CdiProducer.java b/security/src/main/java/org/wildfly/security/soteria/original/CdiProducer.java index 0333eb8e0..5aabc0067 100644 --- a/security/src/main/java/org/wildfly/security/soteria/original/CdiProducer.java +++ b/security/src/main/java/org/wildfly/security/soteria/original/CdiProducer.java @@ -40,7 +40,7 @@ public class CdiProducer implements Bean, PassivationCapable { private String id = this.getClass().getName(); private String name; - private Class beanClass = Object.class; + private Class beanClass = CdiExtension.class; private Set types = singleton(Object.class); private Set qualifiers = unmodifiableSet(asSet(new DefaultAnnotationLiteral(), new AnyAnnotationLiteral())); private Class scope = Dependent.class;