[JBoss JIRA] (WFCORE-4975) Where ModelControllerClient is initialised in process with CBH AuthenticationConfiguration takes priority.
by Darran Lofthouse (Jira)
[ https://issues.redhat.com/browse/WFCORE-4975?page=com.atlassian.jira.plug... ]
Darran Lofthouse updated WFCORE-4975:
-------------------------------------
Description:
In ProtocolConnectionUtils we have the following code to pass in the provided CallbackHanldler: -
{code:java}
if (handler != null) {
mergedConfiguration = mergedConfiguration.useCallbackHandler(handler, DEFAULT_CALLBACK_KINDS);
}
{code}
However the AuthenticationClient performs the following sanitation of the specified KINDS: -
{code:java}
case SET_USER_CB_KINDS:
// SANITAZE on above content
if (this.principal != null) {
sanitazeOnMutation(SET_PRINCIPAL);
}
if (this.credentialSource != null) {
sanitazeOnMutation(SET_CRED_SOURCE);
}
if (this.setRealm != null) {
sanitazeOnMutation(SET_REALM);
}
if (this.parameterSpecs != null) {
sanitazeOnMutation(SET_PARAM_SPECS);
}
if (this.keyManagerFactory != null) {
sanitazeOnMutation(SET_KEY_MGR_FAC);
}
break;
{code}
Before passing in the CallbackHandler and specifying which KINDS is applies to the ProtocolConnectionUtils call should first remove the duplicates from the configuration.
> Where ModelControllerClient is initialised in process with CBH AuthenticationConfiguration takes priority.
> ----------------------------------------------------------------------------------------------------------
>
> Key: WFCORE-4975
> URL: https://issues.redhat.com/browse/WFCORE-4975
> Project: WildFly Core
> Issue Type: Bug
> Components: Security
> Reporter: Darran Lofthouse
> Assignee: Darran Lofthouse
> Priority: Major
> Fix For: 12.0.0.Beta4
>
>
> In ProtocolConnectionUtils we have the following code to pass in the provided CallbackHanldler: -
> {code:java}
> if (handler != null) {
> mergedConfiguration = mergedConfiguration.useCallbackHandler(handler, DEFAULT_CALLBACK_KINDS);
> }
> {code}
> However the AuthenticationClient performs the following sanitation of the specified KINDS: -
> {code:java}
> case SET_USER_CB_KINDS:
> // SANITAZE on above content
> if (this.principal != null) {
> sanitazeOnMutation(SET_PRINCIPAL);
> }
> if (this.credentialSource != null) {
> sanitazeOnMutation(SET_CRED_SOURCE);
> }
> if (this.setRealm != null) {
> sanitazeOnMutation(SET_REALM);
> }
> if (this.parameterSpecs != null) {
> sanitazeOnMutation(SET_PARAM_SPECS);
> }
> if (this.keyManagerFactory != null) {
> sanitazeOnMutation(SET_KEY_MGR_FAC);
> }
> break;
> {code}
> Before passing in the CallbackHandler and specifying which KINDS is applies to the ProtocolConnectionUtils call should first remove the duplicates from the configuration.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (DROOLS-5348) Lambda predicate is not externalized when a binding variable is involved
by Toshiya Kobayashi (Jira)
[ https://issues.redhat.com/browse/DROOLS-5348?page=com.atlassian.jira.plug... ]
Toshiya Kobayashi updated DROOLS-5348:
--------------------------------------
Description:
In CompilerTest#testStringValueOf, there is a case where MaterializedLambdaPredicate is not created.
{code:java}
public static org.drools.model.Rule rule_R() {
final org.drools.model.Variable<java.lang.Integer> var_GENERATED_$pattern_Integer$1$ = D.declarationOf(java.lang.Integer.class,
DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.java_lang_Integer_Metadata_INSTANCE,
"GENERATED_$pattern_Integer$1$");
final org.drools.model.Variable<Integer> var_$i = D.declarationOf(Integer.class, "$i");
final org.drools.model.Variable<org.drools.modelcompiler.domain.Person> var_GENERATED_$pattern_Person$1$ = D.declarationOf(org.drools.modelcompiler.domain.Person.class,
DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.org_drools_modelcompiler_domain_Person_Metadata_INSTANCE,
"GENERATED_$pattern_Person$1$");
org.drools.model.Rule rule = D.rule("R").build(D.pattern(var_GENERATED_$pattern_Integer$1$).bind(var_$i, (java.lang.Integer _this) -> _this.intValue()),
D.pattern(var_GENERATED_$pattern_Person$1$).expr("476633DA7C4638FC84A32859E0C843E6",
var_$i,
(_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
(String.valueOf($i))),
D.reactOn("name")),
D.on(var_$i).execute(defaultpkg.P1D.LambdaConsequence1D5F4C5CA006007B1D3974ED5A5A05B6.INSTANCE));
return rule;
}
{code}
See
{code:java}
expr("476633DA7C4638FC84A32859E0C843E6",
var_$i,
(_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
(String.valueOf($i)))
{code}
It throws DoNotConvertLambdaException in ExecModelLambdaPostProcessor.
{code:java}
private void extractLambdaFromMethodCall(MethodCallExpr methodCallExpr, Supplier<MaterializedLambda> lambdaExtractor) {
methodCallExpr.getArguments().forEach(a -> {
if (a.isLambdaExpr()) {
LambdaExpr lambdaExpr = a.asLambdaExpr();
try {
CreatedClass aClass = lambdaExtractor.get().create(lambdaExpr.toString(), imports, staticImports);
lambdaClasses.put(aClass.getClassNameWithPackage(), aClass);
ClassOrInterfaceType type = StaticJavaParser.parseClassOrInterfaceType(aClass.getClassNameWithPackage());
a.replace(lambdaInstance(type));
} catch(DoNotConvertLambdaException e) {
logger.debug("Cannot externalize lambdas {}", e.getMessage());
}
}
});
}
{code}
In order to externalize, parameters of the lambda need to have their types.
was:
In CompilerTest#testStringValueOf, there is a case where MaterializedLambdaPredicate is not created.
{code:java}
public static org.drools.model.Rule rule_R() {
final org.drools.model.Variable<java.lang.Integer> var_GENERATED_$pattern_Integer$1$ = D.declarationOf(java.lang.Integer.class,
DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.java_lang_Integer_Metadata_INSTANCE,
"GENERATED_$pattern_Integer$1$");
final org.drools.model.Variable<Integer> var_$i = D.declarationOf(Integer.class, "$i");
final org.drools.model.Variable<org.drools.modelcompiler.domain.Person> var_GENERATED_$pattern_Person$1$ = D.declarationOf(org.drools.modelcompiler.domain.Person.class,
DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.org_drools_modelcompiler_domain_Person_Metadata_INSTANCE,
"GENERATED_$pattern_Person$1$");
org.drools.model.Rule rule = D.rule("R").build(D.pattern(var_GENERATED_$pattern_Integer$1$).bind(var_$i, (java.lang.Integer _this) -> _this.intValue()),
D.pattern(var_GENERATED_$pattern_Person$1$).expr("476633DA7C4638FC84A32859E0C843E6",
var_$i,
(_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
(String.valueOf($i))),
D.reactOn("name")),
D.on(var_$i).execute(defaultpkg.P1D.LambdaConsequence1D5F4C5CA006007B1D3974ED5A5A05B6.INSTANCE));
return rule;
}
{code}
See
{code:java}
expr("476633DA7C4638FC84A32859E0C843E6",
var_$i,
(_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
(String.valueOf($i)))
{code}
It throws DoNotConvertLambdaException in ExecModelLambdaPostProcessor.
{code:java}
private void extractLambdaFromMethodCall(MethodCallExpr methodCallExpr, Supplier<MaterializedLambda> lambdaExtractor) {
methodCallExpr.getArguments().forEach(a -> {
if (a.isLambdaExpr()) {
LambdaExpr lambdaExpr = a.asLambdaExpr();
try {
CreatedClass aClass = lambdaExtractor.get().create(lambdaExpr.toString(), imports, staticImports);
lambdaClasses.put(aClass.getClassNameWithPackage(), aClass);
ClassOrInterfaceType type = StaticJavaParser.parseClassOrInterfaceType(aClass.getClassNameWithPackage());
a.replace(lambdaInstance(type));
} catch(DoNotConvertLambdaException e) {
logger.debug("Cannot externalize lambdas {}", e.getMessage());
}
}
});
}
{code}
> Lambda predicate is not externalized when a binding variable is involved
> ------------------------------------------------------------------------
>
> Key: DROOLS-5348
> URL: https://issues.redhat.com/browse/DROOLS-5348
> Project: Drools
> Issue Type: Sub-task
> Components: executable model
> Affects Versions: 7.37.0.Final
> Reporter: Toshiya Kobayashi
> Assignee: Toshiya Kobayashi
> Priority: Major
>
> In CompilerTest#testStringValueOf, there is a case where MaterializedLambdaPredicate is not created.
> {code:java}
> public static org.drools.model.Rule rule_R() {
> final org.drools.model.Variable<java.lang.Integer> var_GENERATED_$pattern_Integer$1$ = D.declarationOf(java.lang.Integer.class,
> DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.java_lang_Integer_Metadata_INSTANCE,
> "GENERATED_$pattern_Integer$1$");
> final org.drools.model.Variable<Integer> var_$i = D.declarationOf(Integer.class, "$i");
> final org.drools.model.Variable<org.drools.modelcompiler.domain.Person> var_GENERATED_$pattern_Person$1$ = D.declarationOf(org.drools.modelcompiler.domain.Person.class,
> DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.org_drools_modelcompiler_domain_Person_Metadata_INSTANCE,
> "GENERATED_$pattern_Person$1$");
> org.drools.model.Rule rule = D.rule("R").build(D.pattern(var_GENERATED_$pattern_Integer$1$).bind(var_$i, (java.lang.Integer _this) -> _this.intValue()),
> D.pattern(var_GENERATED_$pattern_Person$1$).expr("476633DA7C4638FC84A32859E0C843E6",
> var_$i,
> (_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
> (String.valueOf($i))),
> D.reactOn("name")),
> D.on(var_$i).execute(defaultpkg.P1D.LambdaConsequence1D5F4C5CA006007B1D3974ED5A5A05B6.INSTANCE));
> return rule;
> }
> {code}
> See
> {code:java}
> expr("476633DA7C4638FC84A32859E0C843E6",
> var_$i,
> (_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
> (String.valueOf($i)))
> {code}
> It throws DoNotConvertLambdaException in ExecModelLambdaPostProcessor.
> {code:java}
> private void extractLambdaFromMethodCall(MethodCallExpr methodCallExpr, Supplier<MaterializedLambda> lambdaExtractor) {
> methodCallExpr.getArguments().forEach(a -> {
> if (a.isLambdaExpr()) {
> LambdaExpr lambdaExpr = a.asLambdaExpr();
> try {
> CreatedClass aClass = lambdaExtractor.get().create(lambdaExpr.toString(), imports, staticImports);
> lambdaClasses.put(aClass.getClassNameWithPackage(), aClass);
> ClassOrInterfaceType type = StaticJavaParser.parseClassOrInterfaceType(aClass.getClassNameWithPackage());
> a.replace(lambdaInstance(type));
> } catch(DoNotConvertLambdaException e) {
> logger.debug("Cannot externalize lambdas {}", e.getMessage());
> }
> }
> });
> }
> {code}
> In order to externalize, parameters of the lambda need to have their types.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (DROOLS-5348) Lambda predicate is not externalized when a binding variable is involved
by Toshiya Kobayashi (Jira)
[ https://issues.redhat.com/browse/DROOLS-5348?page=com.atlassian.jira.plug... ]
Toshiya Kobayashi updated DROOLS-5348:
--------------------------------------
Description:
In CompilerTest#testStringValueOf, there is a case where MaterializedLambdaPredicate is not created.
{code:java}
public static org.drools.model.Rule rule_R() {
final org.drools.model.Variable<java.lang.Integer> var_GENERATED_$pattern_Integer$1$ = D.declarationOf(java.lang.Integer.class,
DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.java_lang_Integer_Metadata_INSTANCE,
"GENERATED_$pattern_Integer$1$");
final org.drools.model.Variable<Integer> var_$i = D.declarationOf(Integer.class, "$i");
final org.drools.model.Variable<org.drools.modelcompiler.domain.Person> var_GENERATED_$pattern_Person$1$ = D.declarationOf(org.drools.modelcompiler.domain.Person.class,
DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.org_drools_modelcompiler_domain_Person_Metadata_INSTANCE,
"GENERATED_$pattern_Person$1$");
org.drools.model.Rule rule = D.rule("R").build(D.pattern(var_GENERATED_$pattern_Integer$1$).bind(var_$i, (java.lang.Integer _this) -> _this.intValue()),
D.pattern(var_GENERATED_$pattern_Person$1$).expr("476633DA7C4638FC84A32859E0C843E6",
var_$i,
(_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
(String.valueOf($i))),
D.reactOn("name")),
D.on(var_$i).execute(defaultpkg.P1D.LambdaConsequence1D5F4C5CA006007B1D3974ED5A5A05B6.INSTANCE));
return rule;
}
{code}
See
{code:java}
expr("476633DA7C4638FC84A32859E0C843E6",
var_$i,
(_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
(String.valueOf($i)))
{code}
It throws DoNotConvertLambdaException in ExecModelLambdaPostProcessor.
{code:java}
private void extractLambdaFromMethodCall(MethodCallExpr methodCallExpr, Supplier<MaterializedLambda> lambdaExtractor) {
methodCallExpr.getArguments().forEach(a -> {
if (a.isLambdaExpr()) {
LambdaExpr lambdaExpr = a.asLambdaExpr();
try {
CreatedClass aClass = lambdaExtractor.get().create(lambdaExpr.toString(), imports, staticImports);
lambdaClasses.put(aClass.getClassNameWithPackage(), aClass);
ClassOrInterfaceType type = StaticJavaParser.parseClassOrInterfaceType(aClass.getClassNameWithPackage());
a.replace(lambdaInstance(type));
} catch(DoNotConvertLambdaException e) {
logger.debug("Cannot externalize lambdas {}", e.getMessage());
}
}
});
}
{code}
> Lambda predicate is not externalized when a binding variable is involved
> ------------------------------------------------------------------------
>
> Key: DROOLS-5348
> URL: https://issues.redhat.com/browse/DROOLS-5348
> Project: Drools
> Issue Type: Sub-task
> Components: executable model
> Affects Versions: 7.37.0.Final
> Reporter: Toshiya Kobayashi
> Assignee: Toshiya Kobayashi
> Priority: Major
>
> In CompilerTest#testStringValueOf, there is a case where MaterializedLambdaPredicate is not created.
> {code:java}
> public static org.drools.model.Rule rule_R() {
> final org.drools.model.Variable<java.lang.Integer> var_GENERATED_$pattern_Integer$1$ = D.declarationOf(java.lang.Integer.class,
> DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.java_lang_Integer_Metadata_INSTANCE,
> "GENERATED_$pattern_Integer$1$");
> final org.drools.model.Variable<Integer> var_$i = D.declarationOf(Integer.class, "$i");
> final org.drools.model.Variable<org.drools.modelcompiler.domain.Person> var_GENERATED_$pattern_Person$1$ = D.declarationOf(org.drools.modelcompiler.domain.Person.class,
> DomainClassesMetadata81A66AD685F7689036AAA5128956C14B.org_drools_modelcompiler_domain_Person_Metadata_INSTANCE,
> "GENERATED_$pattern_Person$1$");
> org.drools.model.Rule rule = D.rule("R").build(D.pattern(var_GENERATED_$pattern_Integer$1$).bind(var_$i, (java.lang.Integer _this) -> _this.intValue()),
> D.pattern(var_GENERATED_$pattern_Person$1$).expr("476633DA7C4638FC84A32859E0C843E6",
> var_$i,
> (_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
> (String.valueOf($i))),
> D.reactOn("name")),
> D.on(var_$i).execute(defaultpkg.P1D.LambdaConsequence1D5F4C5CA006007B1D3974ED5A5A05B6.INSTANCE));
> return rule;
> }
> {code}
> See
> {code:java}
> expr("476633DA7C4638FC84A32859E0C843E6",
> var_$i,
> (_this, $i) -> org.drools.modelcompiler.util.EvaluationUtil.areNullSafeEquals(_this.getName(),
> (String.valueOf($i)))
> {code}
> It throws DoNotConvertLambdaException in ExecModelLambdaPostProcessor.
> {code:java}
> private void extractLambdaFromMethodCall(MethodCallExpr methodCallExpr, Supplier<MaterializedLambda> lambdaExtractor) {
> methodCallExpr.getArguments().forEach(a -> {
> if (a.isLambdaExpr()) {
> LambdaExpr lambdaExpr = a.asLambdaExpr();
> try {
> CreatedClass aClass = lambdaExtractor.get().create(lambdaExpr.toString(), imports, staticImports);
> lambdaClasses.put(aClass.getClassNameWithPackage(), aClass);
> ClassOrInterfaceType type = StaticJavaParser.parseClassOrInterfaceType(aClass.getClassNameWithPackage());
> a.replace(lambdaInstance(type));
> } catch(DoNotConvertLambdaException e) {
> logger.debug("Cannot externalize lambdas {}", e.getMessage());
> }
> }
> });
> }
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month
[JBoss JIRA] (WFLY-13498) @ApplicationScoped Bean Not Eagerly Instantiated on Wildfly 16
by Fearghal O Maolcatha (Jira)
[ https://issues.redhat.com/browse/WFLY-13498?page=com.atlassian.jira.plugi... ]
Fearghal O Maolcatha commented on WFLY-13498:
---------------------------------------------
I thought I might have been able to reproduce the issue with one of the quickstart applications on Wildfly v16.0.0.Final but it seemed to work fine there.
We migrated our application from Wildfly 9 and Java 8 to Wildfly 16 and Java 11. Maybe something in our configuration is resulting in this issue. Would the size of the application make a difference, could it result in a timing/race condition?
When I debugged through the issue over a month ago, I noticed that org.jboss.weld.bootstrap.BeanDeploymentModules:processBeanDeployments hadn't processed all CDI beans in the lib jars before the ServletContext was initialized. Should this be the case?
> @ApplicationScoped Bean Not Eagerly Instantiated on Wildfly 16
> --------------------------------------------------------------
>
> Key: WFLY-13498
> URL: https://issues.redhat.com/browse/WFLY-13498
> Project: WildFly
> Issue Type: Bug
> Components: CDI / Weld
> Affects Versions: 16.0.0.Final
> Reporter: Fearghal O Maolcatha
> Assignee: Matěj Novotný
> Priority: Major
>
> I have an @ApplicationScoped bean that I want to be instantiated on application startup (see sample code below). I've registered for the servlet context initialization event but the init method is never invoked. The FactoryLocator is contained in a jar within my war's WEB-INF/lib directory. This same code was working on Wildfly 9 but no longer works after upgrading to Wildfly 16.
> {code:java}
> import javax.enterprise.context.ApplicationScoped;
> import javax.enterprise.context.Initialized;
> import javax.enterprise.event.Observes;
> import javax.servlet.ServletContext;
> @ApplicationScoped
> public class FactoryLocator {
> public FactoryLocator() {
> System.out.println("In the constructor.........................");
> }
> private void init(@Observes @Initialized(ApplicationScoped.class) ServletContext sc) {
> System.out.println("Invoking the event observer method..................");
> }
> }
> {code}
> One workaround I discovered was to extract the contents of the jars in my war's WEB-INF/lib/ directory to my war's WEB-INF/classes directory. When I did this my FactorLocator bean was instantiated successfully. I'd prefer not to have to do this.
> After debugging through the war's deployment, I noticed that the ServletContext is initialized before all the beans in the war's lib directory are processed (org.jboss.weld.bootstrap.BeanDeploymentModules:processBeanDeployments). The war's module is not aware of all observers until all the beans are processed. However, the ServletContextEvent is fired before all the observers are known.
> Should this happen that ServletContext is created before all observers are known about? I've debugged one of the Wildfly QuickStart applications and the ServletContext isn't created until all bean deployments are processed and the code below is executed successfully. Is the order in which this happens supposed to be guaranteed?
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 1 month