[jboss-jira] [JBoss JIRA] (JBRULES-3465) KnowlegeAgentConfiguration should support a username and password property for HTTP authentication when the changset.xml itself is retrieved from HTTP (or shouldn't contain the username/password).

nett victoria (JIRA) jira-events at lists.jboss.org
Mon Aug 26 18:15:26 EDT 2013


    [ https://issues.jboss.org/browse/JBRULES-3465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12799352#comment-12799352 ] 

nett victoria commented on JBRULES-3465:
----------------------------------------

Hi,

Can i please have an update on whether username or password is supported at all in KnowledgeAgentConfiguration? In my project it is discouraged to check-in any username or password on subversion, so we are passing it from the command line. Thing is, I am getting HTTP 401 when I move out the code to set username/password from change-set.xml onto the KnowledgeAgentConfiguration this way: 

		KnowledgeAgentConfiguration conf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
		conf.setProperty ("enableBasicAuthentication", "true");
		conf.setProperty ("username", username);
		conf.setProperty ("password", password);

		KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("kagent", conf);
		kagent.applyChangeSet(ResourceFactory.newClassPathResource("rules/change-set.xml"));
		StatelessKnowledgeSession ksession =  kagent.newStatelessKnowledgeSession();

Please advise how I can set the username/password to connect to Guvnor programmatically. Thank you.
	
                
> KnowlegeAgentConfiguration should support a username and password property for HTTP authentication when the changset.xml itself is retrieved from HTTP (or shouldn't contain the username/password).
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-3465
>                 URL: https://issues.jboss.org/browse/JBRULES-3465
>             Project: JBRULES
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: drools-api
>    Affects Versions: 5.4.0.CR1
>            Reporter: Geoffrey De Smet
>
> Currently, you can workaround like this sometimes:
> {code}
>         KnowledgeAgentConfiguration conf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
>         Authenticator.setDefault(new Authenticator() { // =========================== BAD - Does NOT work when there are multiple agents with different usernames
>             @Override
>             protected PasswordAuthentication getPasswordAuthentication() {
>                 return new PasswordAuthentication("admin", "admin".toCharArray());
>             }
>         });
>         KnowledgeAgent ka = KnowledgeAgentFactory.newKnowledgeAgent("test", conf);
> {code}
> we should support this::
> {code}
>         KnowledgeAgentConfiguration conf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
>         conf.setUsername("admin"); // Or via setProperty()
>         conf.setPasword("admin".toCharArray()); // Or via setProperty()
>         KnowledgeAgent ka = KnowledgeAgentFactory.newKnowledgeAgent("test", conf);
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list