how to save application users created in jboss in a database or serialize them - jboss

I want to migrate the management and application users created in jboss using add-user.bat utility while upgrading the jboss version.
For that i was thinking if it is possible to store the users created in jboss in a database or may be something like serializing them while creating and update the jaas cache of the jboss server at the time of boot up.
Is there any way to export the user list from an existing jboss installation?
So can anyone please help me with either of the above?
Or may you please suggest me which should be the best approach?

Unfortunately, there is no direct way of exporting application/management users from the JBoss server. But all the application and management users created for jboss will present in application-users.properties and mgmt-users.properties files.
You can get usernames with the encrypted password in the following format
username=HEX( MD5( username ':' realm ':' password))
e.g.
admin=2a0923285184943425d1f53ddd58ec7a
All the roles and groups for the users will present in application-roles.properties
and mgmt-groups.properties files.
Location for above files :
standalone mode: JBOSS_HOME/standalone/configuration/
domain mode: JBOSS_HOME/domain/configuration/

Related

How do I connect to multiple databases using JPA Glassfish Java EE?

I have an application using JSF,EJB,JPA, Glassfish. There are multiple(may be around thousand or more) clients using my app, however each client has a separate database. All the databases have the same schema. I would like to determine which database connection to use at the time when a user logs into the system.
For example client A enters client code, username, and password and logs in, I determine that client A belongs to database A, grab the connection for database A and continue on my merry way.
I am using JPA as my persistence provider. Is it possible to set datasource in persistence.xml at runtime? Is there .java version of persistence.xml available? Is there a better/preferred way to do this? PersistenceUnit name will be same for all the connections.
Thanks
If you know all users in advance then you can create separate persistence unit for every user in persistence.xml and use factory for select Persistence Unit Name for users. Addition of users, require modification in persistence.xml and redeployment of Application.

got forbidden login in on Kie-server

I'm following one tutorial to get kie-drools-workbench and kie-server working: https://www.intertech.com/Blog/simple-setup-of-drools-kie-workbench-and-kie-server-in-one-wildfly-instance/
Installed wildfly and downloaded the kie-server-6.4.0.Final-ee7 and kie-drools-wb-distribution-wars-6.4.0.Final-wildfly8 and move them to C:\apps\wildfly-8.2.1.Final\standalone\deployments
Created user jeff with roles admin and developer on wildfly like the tutorial shows.
on CMD start standalone which starts wildfly 8.2.1
got at C:\apps\wildfly-8.2.1.Final\standalone\deployments
- kie drools .war and .deployed
- kie server 64.0 .war and .deployed
Login with jeff user at administration on http://localhost:8080/ and got redirected to http://localhost:9990/console/App.html#home
Under deployments I have the kie-server and kie-drools enabled, how can I access them?
I can land to the kie Workbench with kie server user at http://localhost:8080/kie-drools-wb-distribution-wars-6.4.0.Final-wildfly8/kie-drools-wb.html but I can't land on the kie-server, got forbidden with user jeff or user kieserver at http://localhost:8080/kie-server-6.4.0.Final-ee7/services/rest/server/containers
I don't find why, I login with jeff user but got forbidden and have to restart all to try another user / pass, like kieserver user.
I access kie-workbench, loggin with kieserver user and under deploy -> rule deployments -> remote servers got the kie server link, but the problem is the same, can't access it. forbidden and only have one shot to get the user pass right, or else I have to restart it.
The objective is to work better with drools rules and debug rules the best way, get to check which fact are loaded and which rules are applied to each fact..
Does anyone got the same issue? Or got something like what I need working?
EDIT: I can work with rules on kie-Drools-wb, the question is, do I really need the kie server to start? Because I only need to create rules based one a database.
I think I found the solution.
I don't need to use the server, the server is wildfly and should be running by then, the drools Workbench as explained on the tutorial works and the demo project is the sandbox.
This is only for academic purposes.

How to store MongoDB database config information in a web application?

While using relational databases like MySQL, we can create a JNDI resource in GlassFish server(which I am using) and then use it as DataSource by looking up the context.
Is there an equivalent way for doing this for MongoDB in GlassFish?
If no then what is the best way to store the connection details like DB username and password for MongoDB without hard-coding them into the application or having some kind of properties files inside the web application from where we access the connections details?
I am using a Java Servlet as my web technology.
You can define an alias in glassfish for your password and access it by calling System.getProperty("mypassword")

HSQLDB in-memory mode persistence with JBoss

Is it possible to use HSQLDB in in-memory mode and to save the data while JBoss is running and/or when JBoss stops?
Thanks in advance
An all-in-memory database has a URL in the form jdbc:hsqldb:mem:thename
With this type of database as with all other types, you can use SCRIPT 'file path' to save a copy of the database to the file you specify.
Now someone else can show you how to execute an SQL command in the JBoss process in different ways. I have seen some examples on the web in the past.

JBoss default password

What's the JBoss 5.x EAP default web console password?
The default credentials are:
login: admin
password: admin
But if you use EAP these credentials are turned off by default and there is no active user (security reasons :)). If you want to turn on these users, you have to edit the following file in your current profile: ./deploy/management/console-mgr.sar/web-console.war/WEB-INF/classes/web-console-users.properties. It should be enough to remove the # sign from the line with the user.
If you want to create a new user, don't forget to set up the correct groups in web-console-roles.properties file.
You can easily find information where these information are stored: just open the ./conf/login-config.xml file and find the proper security domain definition. In the case of the Web Console application, it will be web-console policy.
Also if you want to have access to JMX, you have unlock JMX Console. Just check the following files in the conf/props/ directory (in your profile): jmx-console-users.properties and jmx-console-roles.properties.
I just had to uncomment the line in jboss-eap-5.0\jboss-as\server\default\conf\props\jmx-console-users.properties
admin=admin
Thats it. Restart Jboss and I was about to get in to JBOSS JMX. Magically this even fixed the error that I used to get while shutting down Jboss from Eclipse.
I can also verify the above solution except I had to change in
**..\server\<server profile>\conf\props\jmx-console-users.properties**
If you are using Talend MDM Server, the login is:
login: admin
password: talend
See more: http://wiki.glitchdata.com/index.php?title=TOS:_Accessing_the_Talend_MDM_Server
This differs from the default JBoss login of admin/admin
The password setup file is also login-config.xml in this case.
I suggest visit Add digest auth in jmx-console and read oficial documentation for Configure admin consoles, you can add more security to your JBoss AS console and at these link explains where are the role and user/pass files that you need to change this information for your server and how you can change them. Also I recommend you quit all consoles that you don't use because they can affect to application server's performance.
Also there are others links about securing jmx-console that could help you, search in jboss as community site for them (I can't put them here for my actual reputation,sorry). Never you should has the password in plain text over conf/props/ files.
Sorry for my bad English and I hope my answer be useful for you.
just commenting the line of user and password in file
./server/default/conf/props jmx-console-users.properties worked for me
Step 1:
jmx-console-users.properties
admin=admin
Step 2:
jmx-console-roles.properties
admin=JBossAdmin,HttpInvoker
Step 3: Restart or start the JBoss instance.
Now you should good to go...
Go to the jmx console, enter JBoss login URL, then enter admin as username and admin password.
as suggested in other posts, probably you don't have any user defined. it's not advisable to manually edit the configuration files. you should use the add-user (.sh or .cmd) utility as explained in https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Installation_Guide/chap-Getting_Started_with_JBoss_Enterprise_Application_Platform_6.html#Add_the_Initial_User_for_the_Management_Interfaces