Drools 6.0 | Workbench Authentication | JAAS with DB
by Zahid Ahmed
Hi,
I am configuring DB based JAAS Authentication for Kie-Drools-Workbench 6.1.0. Server log shows user is authenticated and roles are assigned to the user. But KIE login form says "Login failed: Not Authorized ".
I have also added roles in Organizational Unit, Repository and Projects using kie-config-cli. But still getting the same error.
Kindly let me know what wrong am I doing.
Standalone.xml
<security-domain name="drools-guvnor" cache-type="default">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName" value="java:jboss/datasources/jdbc/jbpmStagingRWDS"/>
<module-option name="principalsQuery" value="select PASSWORD from principals where PRINCIPALID=?"/>
<module-option name="rolesQuery" value="select ROLE,ROLEGROUP from roles WHERE principalid=?"/>
<module-option name="hashAlgorithm" value="MD5"/>
<module-option name="hashEncoding" value="base64"/>
<module-option name="hashCharset" value="UTF-8"/>
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
Kie-drools-wb.War / WEB_INF/jboss-web.xml|
<security-domain>drools-guvnor</security-domain>
Server Logs
13:55:22,408 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) initialize
13:55:22,410 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Security domain: other
13:55:22,412 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Password hashing activated: algorithm = MD5, encoding = base64, charset = UTF-8, callback = null, storeCallback = null
13:55:22,415 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) DatabaseServerLoginModule, dsJndiName=java:jboss/datasources/jdbc/jbpmStagingRWDS
13:55:22,419 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) principalsQuery=select PASSWORD from principals where PRINCIPALID=?
13:55:22,422 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) rolesQuery=select ROLE,ROLEGROUP from roles WHERE principalid=?
13:55:22,424 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) suspendResume=true
13:55:22,426 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) login
13:55:22,428 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) suspendAnyTransaction
13:55:22,489 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Excuting query: select PASSWORD from principals where PRINCIPALID=?, with username: iit
13:55:22,495 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Obtained user password
13:55:22,497 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) resumeAnyTransaction
13:55:22,499 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) User 'iit' authenticated, loginOk=true
13:55:22,501 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) commit, loginOk=true
13:55:22,503 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) getRoleSets using rolesQuery: select ROLE,ROLEGROUP from roles WHERE principalid=?, username: iit
13:55:22,507 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) suspendAnyTransaction
13:55:22,509 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Excuting query: select ROLE,ROLEGROUP from roles WHERE principalid=?, with username: iit
13:55:22,514 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Assign user to role admin
13:55:22,516 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Assign user to role analyst
13:55:22,518 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Assign user to role developer
13:55:22,521 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Assign user to role manager
13:55:22,523 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) Assign user to role user
13:55:22,525 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) resumeAnyTransaction
13:55:22,527 TRACE [org.jboss.security.authentication.JBossCachedAuthenticationManager] (http--127.0.0.1-8080-2) defaultLogin, lc=javax.security.auth.login.LoginContext@3460a6, subject=Subject(11883582).principals=org.jboss.security.SimplePrincipal@25145532(iit)org.jboss.security.SimpleGroup(a)12885648(CallerPrincip
al(members:iit))org.jboss.security.SimpleGroup@12885648(admingrp(members:admin))org.jboss.security.SimpleGroup@12885648(usergrp(members:user))org.jboss.security.SimpleGroup@12885648(analystgrp(members:analyst))org.jboss.security.SimpleGroup@12885648(developergrp(members:developer))org.jboss.security.SimpleGroup@12
885648(managergrp(members:manager))
13:55:22,538 TRACE [org.jboss.security.authentication.JBossCachedAuthenticationManager] (http--127.0.0.1-8080-2) updateCache, inputSubject=Subject(11883582).principals=org.jboss.security.SimplePrincipal@25145532(iit)org.jboss.security.SimpleGroup@12885648(CallerPrincipal(members:iit))org.jboss.security.SimpleGroup
@12885648(admingrp(members:admin))org.jboss.security.SimpleGroup@12885648(usergrp(members:user))org.jboss.security.SimpleGroup@12885648(analystgrp(members:analyst))org.jboss.security.SimpleGroup@12885648(developergrp(members:developer))org.jboss.security.SimpleGroup@12885648(managergrp(members:manager)), cacheSubj
ect=Subject(11399784).principals=org.jboss.security.SimplePrincipal@25145532(iit)org.jboss.security.SimpleGroup@12885648(CallerPrincipal(members:iit))org.jboss.security.SimpleGroup@12885648(admingrp(members:admin))org.jboss.security.SimpleGroup@12885648(usergrp(members:user))org.jboss.security.SimpleGroup@12885648
(analystgrp(members:analyst))org.jboss.security.SimpleGroup@12885648(developergrp(members:developer))org.jboss.security.SimpleGroup@12885648(managergrp(members:manager))
13:55:22,556 TRACE [org.jboss.security.authentication.JBossCachedAuthenticationManager] (http--127.0.0.1-8080-2) Inserted cache info: org.jboss.security.authentication.JBossCachedAuthenticationManager$DomainInfo@5bd7b
13:55:22,560 TRACE [org.jboss.security.authentication.JBossCachedAuthenticationManager] (http--127.0.0.1-8080-2) End isValid, true
13:55:22,562 TRACE [org.jboss.security.SecurityRolesAssociation] (http--127.0.0.1-8080-2) Setting threadlocal:null
13:55:22,576 TRACE [org.jboss.security.SecurityRolesAssociation] (http--127.0.0.1-8080-2) Setting threadlocal:null
13:55:22,578 TRACE [org.jboss.security.authentication.JBossCachedAuthenticationManager] (http--127.0.0.1-8080-2) Flushing iit from cache
13:55:22,580 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] (http--127.0.0.1-8080-2) logout
13:55:22,841 TRACE [org.jboss.security.SecurityRolesAssociation] (http--127.0.0.1-8080-3) Setting threadlocal:null
13:55:22,845 TRACE [org.jboss.security.SecurityRolesAssociation] (http--127.0.0.1-8080-2) Setting threadlocal:null
13:55:22,845 TRACE [org.jboss.security.SecurityRolesAssociation] (http--127.0.0.1-8080-1) Setting threadlocal:null
Config Tool
********************************************************
************* Welcome to Kie config CLI ****************
********************************************************
>>Please specify location of the parent folder of .niogit
D:\Servers\Drools-6-Deployment\Server-A-As-7\bin
>>Please enter command (type help to see available commands):
add-role-repo
>>Repository alias:netsolrepo
>>Security roles (comma separated list):admin,analyst,business,user,developer
Result:
Role admin added successfully to repository netsolrepo
Role analyst added successfully to repository netsolrepo
Role business added successfully to repository netsolrepo
Role user added successfully to repository netsolrepo
Role developer added successfully to repository netsolrepo
>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>Please enter command (type help to see available commands):
add-role-org-unit
>>Organizational Unit name:netsol
>>Security roles (comma separated list):admin,analyst,business,user,developer
Result:
Role admin added successfully to Organizational Unit netsol
Role analyst added successfully to Organizational Unit netsol
Role business added successfully to Organizational Unit netsol
Role user added successfully to Organizational Unit netsol
Role developer added successfully to Organizational Unit netsol
Regards,
Zahid Ahmed
11 years, 7 months
Unable to resolve class error , drools 5.5 in concurrent execution. JSR94Support and Spring
by maruthi_s
Hi ,
We use Drools 5.5 and drool implementation is done through Spring
JSR94Support API>
The Rule engine is called in concurrent mode,
i.e , JSR94Support.executeStateless(name,list) is executed through multiple
threads.
And when the rules are executed we randomly get the following exception
org.drools.RuntimeDroolsException: Unable to resolve class 'someclass(this
is sample)here actual class is printed>'
at
org.drools.base.ClassFieldAccessorCache.getClass(ClassFieldAccessorCache.java:126)
at
org.drools.base.ClassFieldAccessorCache.getClassObjectType(ClassFieldAccessorCache.java:48)
at
org.drools.reteoo.ClassObjectTypeConf.<init>(ClassObjectTypeConf.java:83)
at
org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:71)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:159)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.reteoo.ReteooStatelessSession.executeWithResults(ReteooStatelessSession.java:273)
The rules are registered every 15 minutes through
RuleAdministrator.registerRuleExecutionset ,
so whenever we refresh the rules and the subsequent thread even after the
registration is completed, fails with the above message. This happens only
when the rules are invoked concurrently.
Please advise.
--
View this message in context: http://drools.46999.n3.nabble.com/Unable-to-resolve-class-error-drools-5-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Usage of java.util.List in Drools Guvnor 5.5.0
by Rajeswari
Created a Model in Guvnor 5.5.0 with 3 fields - 2 Text, 1 java.util.List
The model is verified and validated - correctly.
Source looks like below
declare FormatConfig
fieldName: String
regEx: String
regExPatterns: java.util.List
end
While trying to create a Business Rule using the above created Model. The
rule gets fired and works fine.
rule "MyFormat"
dialect "mvel"
when
config : FormatConfig( fieldName == "AMOUNT" )
then
config.setRegEx( "123" );
retract( config );
end
But, the moment I try to use the List, by only declaring a List in the
"When" section, the rule stops working.
rule "MyFormat"
dialect "mvel"
when
config : FormatConfig( fieldName == "AMOUNT" )
regExPatterns1: java.util.List ( )
then
config.setRegEx( "123" );
retract( config );
end
My final intention is to modify the regExPatterns list in the "THEN" block
--
View this message in context: http://drools.46999.n3.nabble.com/Usage-of-java-util-List-in-Drools-Guvno...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
How to migrate data from Guvnor 5.1.1 to 5.3.3.Final version.
by LaKhI ReDdY!!!!!!!!!!!
Hi ,
I need information on how to migrate existing repository from Guvnor 5.1.1
to 5.3.3.Final version.
Currently i am using Guvnor 5.1.1 version and data is stored in Oracle
database. I am moving to Guvnor 5.3.3.Final version.
I would like to migrate the existing data from Guvnor 5.1.1 to 5.3.3.Final
instance.
One way i see is export from Guvnor 5.1.1 and import the exported xml in
Guvnor 5.3.3.Final instance.
Is there any other way to migrate the data?
Regards,
Lakshmi Reddy
11 years, 7 months
Usage of List in Drools 5.5.0
by Rajeswari Devadass
Created a Model in Guvnor 5.5.0 with 3 fields - 2 Text, 1 java.util.List
The model is verified and validated - correctly.
Source looks like below
declare FormatConfig
fieldName: String
regEx: String
regExPatterns: java.util.List
end
While trying to create a Business Rule using the above created Model. The
rule gets fired and works fine.
rule "MyFormat"
dialect "mvel"
when
config : FormatConfig( fieldName == "AMOUNT" )
then
config.setRegEx( "123" );
retract( config );
end
But, the moment I try to use the List, by only declaring a List in the
"When" section, the rule stops working.
rule "MyFormat"
dialect "mvel"
when
config : FormatConfig( fieldName == "AMOUNT" )
regExPatterns1: java.util.List ( )
then
config.setRegEx( "123" );
retract( config );
end
My final intention is to modify the regExPatterns list in the "THEN" block
11 years, 7 months
kbase using kie
by Chris B
I am using 6.0.1 and having difficulties in kmodule.xml.
My goal is to have a directory where I can keep putting new rules which
should be automatically picked up.
But looks like drools is looking in the jar file for new rules.
What should be my entries.
My current kmodule.xml
###################
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="rules" packages="DRL" eventProcessingMode="stream">
<ksession name="ksession-rules"/>
</kbase>
</kmodule>
My pom.properties
####################
#Generated by Maven
#Wed Jun 25 17:53:00 PDT 2014
version=0.0.1
groupId=com.myc
artifactId=MyProject
The output which I am getting
#####################
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [INFO] Found kmodule:
jar:file:/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar!/META-INF/kmodule.xml
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] KieModule URL
type=jar
url=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Found and used
pom.properties META-INF/maven/com.myc/MyProject/pom.properties
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Discovered
classpath module com.myc:MyProject:0.0.1
2014-06-29 16:45:09 o.d.c.k.b.i.KieRepositoryImpl [INFO] KieModule was
added:ZipKieModule[
ReleaseId=com.myc:MyProject:0.0.1file=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar]
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [INFO] Found kmodule:
jar:file:/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar!/META-INF/kmodule.xml
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] KieModule URL
type=jar
url=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Found and used
pom.properties META-INF/maven/com.myc/MyProject/pom.properties
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Discovered
classpath module com.myc:MyProject:0.0.1
2014-06-29 16:45:09 o.d.c.k.b.i.KieRepositoryImpl [INFO] KieModule was
added:ZipKieModule[
ReleaseId=com.myc:MyProject:0.0.1file=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar]
2014-06-29 16:45:09 o.d.c.k.b.i.AbstractKieModule [WARN] No files found for
KieBase rules
----------------------------
As above it is not able to read the rules as the rules are located in the
filesystem somewhere else like in /a/b/c directory and it is in the
classpath, but not being read as it seems to be only looking in jar file
Any help greatly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/kbase-using-kie-tp4030187.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Dynamic rules and inheritance
by ventilo35@free.fr
Hi
I'm exploring using dynamic rules (using Drools 6.0.0 Final), and I see a curious behaviour when the knowledge is built using inheritance.
What I notice is
- new rules which have conditions based on subclasses are fired all right
- but new rules which have conditions based on the base class are not always fired
- they are fired only if some initial rules where fired, based on the base class (?!?)
Here is an runnable example for clarity:
// knowledge classes
public static class Person {
private String firstName;
private String lastName;
public void setFirstName(String fname) {
this.firstName = fname;
}
public void setLastName(String lname) {
this.lastName = lname;
}
public String getFirstName() {
return this.firstName;
}
public String getLastName() {
return this.lastName;
}
}
public static class Contact extends Person {
private String msisdn;
public void setMsisdn(String m) {
this.msisdn = m;
}
public String getMsisdn() {
return this.msisdn;
}
}
// Drools session
KieServices ks = KieServices.Factory.get();
KieModuleModel kieModuleModel = ks.newKieModuleModel();
KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel( "rules")
.setDefault( true )
.setEqualsBehavior( EqualityBehaviorOption.EQUALITY )
.setEventProcessingMode( EventProcessingOption.STREAM );
KieSessionModel ksessionModel1 = kieBaseModel1.newKieSessionModel( "KSession1" )
.setDefault( true )
.setType( KieSessionModel.KieSessionType.STATEFUL )
.setClockType( ClockTypeOption.get("realtime") );
KieFileSystem kfs = ks.newKieFileSystem();
ReleaseId ri = ks.newReleaseId( "org.default", "artifact", "1.0.0" );
kfs.generateAndWritePomXML(ri);
// initial rules
kfs.write("src/main/resources/rules/initial.drl", ks.getResources().newFileSystemResource("src/main/resources/rules/initial.drl").setResourceType(ResourceType.DRL));
KieBuilder kieBuilder = ks.newKieBuilder( kfs ).buildAll();
KieContainer kContainer = ks.newKieContainer(ri);
KieSession kSession = kContainer.newKieSession();
Contact alice = new Contact();
alice.setFirstName("Alice");
alice.setLastName("Doe");
kSession.insert(alice);
Contact bob = new Contact();
bob.setFirstName("Bob");
bob.setLastName("Tester");
kSession.insert(bob);
kSession.fireAllRules();
// new rules
kfs = ks.newKieFileSystem();
ReleaseId ri2 = ks.newReleaseId( "org.default", "artifact", "1.1.0" );
kfs.generateAndWritePomXML(ri2);
kfs.write("src/main/resources/rules/initial.drl", ks.getResources().newFileSystemResource("src/main/resources/rules/initial.drl"));
kfs.write("src/main/resources/rules/newrules.drl", ks.getResources().newFileSystemResource("src/main/resources/rules/newrules.drl"));
kieBuilder = ks.newKieBuilder( kfs ).buildAll();
kContainer.updateToVersion(ri2);
kSession.fireAllRules();
initial.drl :
package com.sample
import com.sample.DroolsTest.Person;
import com.sample.DroolsTest.Contact;
rule "Hello World 1"
when
c: Contact()
then
System.out.println("initial, working, found Contact "+c.getFirstName());
end
rule "Hello World 2"
when
p: Person()
then
System.out.println("initial, working, found Person "+p.getFirstName());
end
newrules.drl :
package com.sample
import com.sample.DroolsTest.Person;
import com.sample.DroolsTest.Contact;
rule "Hello World 3"
when
c: Contact()
then
System.out.println("new rule, working, found Contact "+c.getFirstName());
end
rule "Hello World 4"
when
p: Person()
then
System.out.println("new rule, working, found Person "+p.getFirstName());
end
This examples produces :
initial, working, found Contact Bob
initial, working, found Contact Alice
initial, working, found Person Bob
initial, working, found Person Alice
new rule, working, found Contact Bob
new rule, working, found Contact Alice
new rule, working, found Person Bob
new rule, working, found Person Alice
But, if you comment out rule #2 in initial.drl, then the output becomes:
initial, working, found Contact Bob
initial, working, found Contact Alice
new rule, working, found Contact Bob
new rule, working, found Contact Alice
i.e. rule #4 isn't fired anymore...
Is this explainable?
Thanks
Francois
11 years, 7 months
Drools Session Persistence
by calcacuervo
Hey Guys.
I would like to persist a ksession in drools 6, but not every time I
interact with the session, as this would impact the performance and we have
lot of events and facts inserted per second.
Is this possible to manually persisting the session (for example, on
undeployment), and then, at the app startup load it?
Thanks!
Demian
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Session-Persistence-tp4030204.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months