Keycloak configure with PostgreSQL - postgresql

I develop Spring Boot Rest API project using JDBC and the database is PostgreSQL. I added authorization with Keycloak. I wanna use User Federation because I would like to use Users in my PostgreSQL DB. How can I use it and other ways not to use User Federation?

I have faced the same problem recently. I have different clients with different RDBMS, so I have decided to address this problem so that I could reuse my solution across multiple clients.
I published my solution as a multi RDBMS implementation (oracle, mysql, postgresl, sqlserver) to solve simple database federation needs, supporting bcrypt and several types of hashes.
Just build and deploy this solution on keycloak and configure it through the admin console providing jdbc connection string, login, password, the required SQL queries and the type of hash used.
Feel free to clone, fork or do whatever you need to solve your issue.
GitHub repo:
https://github.com/opensingular/singular-keycloak-database-federation

I'm doing similar development but with Oracle and JSF.
I created a project with three classes:
one implementing UserStorageProvider, UserLookupProvider and CredentialInputValidator
one implementing UserStorageProviderFactory
one extending AbstractUserAdapter
Then I created another project which creates an ear file containing the jar file generated in the previous project plus the driver jar file (of PostgreSQL in your case) inside a lib folder.
Finally the ear file is copied in the /opt/jboss/keycloak/standalone/deployments/ folder of the Keycloak server and it gets autodeployed as a SPI. It's necessary to add this provider in the User federation section of the administration application of Keycloak.

Related

WSO2 Identity Manager 5.6 : backup and restore procedures

Good morning,
I looked in the forum here and could not find the answer. If I overlooked it, I apologize...
I just joined an existing project team using WSO2 Identity Manager 5.6 and API Gateway.
I understand that WSO2 Identity Manager is made up of several components, among which openLDAP (which contains a Berkeley database) and a postgreSQL database.
The current backup / restore procedures simply 'tar' the whole directory which contains all files related to WSO2 (including directories which contain database files), without stopping WSO2.
I'm a bit doubtful about this type of process for backing up. Is that the right thing to do?
If not, what would the right procedure be?
If I understand correctly, postgreSQL is only used for WSO2 'internal state data' storage, so backing it up may not be useful. So I'm thinking that maybe an export of openLDAP (slapcat command) be enough.
Backing openLDAP is probably not enough. Depending on how the WSO2 components (IS + APIM) are installed, you may also have H2 DBs for the local registry, Solr indexes for the UI, Velocity templates for API deployments, and/or Synapse XMLs for the APIs.
I recommend you to first compare your installation directories and files with the vanilla zips so you know how is it configured before changing your backup process.

how to connect to jasperserver repository database

I need to import some pdf files into jasper server, for this i need to access JICONTENTRESOURCE table of repository database.
But I could not find a way to locate my repository's database (default POSTGRESQL). Can any one explain how to connect to jasperserver repository database using SQL developer/ or any other tool. thanks in advance.
Default repository DB name is 'jasperserver'. Credentials depend on what you specified during installation (default_master.properties file in case WAR file was used).
Although, you should upload resources by interacting with the application. You could use web UI (View/Repository then right-click on folder and select Add resource/File/Content Resource) or REST API web services to design a script/programm to automate the process.

Bluemix Liberty SQLDB

I have created an "enterprise template" Liberty server with an EAR file application requiring a few SQLDB connections. This is working and I am able to cf push this server to the Bluemix environment.
My question is how do I go about packaging the entire content and publish this to Bluemix in ONE action (i.e., they will have an instance of the same application running on Liberty with the same SQLDB table setup).
From my quick browsing of the blogs and Q&A, I have only found articles talking about creating the SQLDB ahead of time, packaging the Liberty runtime as a .zip file, and then using cf push to Bluemix. Because the SQLDB was created ahead of time, the DB connections would work.
So is there a way to package the Liberty server with the SQLDB creation as one entity into perhaps one "buildpack"? If so, can someone guide me on the steps involved? (or articles/blogs, anything would help)
You can't do it.
If you want create a script that do all operations in one time, an idea is create a simple job (in java for example) that you can launch in your script.
The job should perform these steps:
connect to sqldb - bluemix service using VCAP_SERVICES (for this
step you can see the documentation
https://www.ng.bluemix.net/docs/#services/SQLDB/index.html#SQLDB
run DDL (create table, ...) in your little job
close connection
Another option is to package a database migration helper (something like Flyway in the application. Then you can invoke it using Java, on application startup (we've had good luck with #singleton #startup EJBs for this pattern). The migration will run when needed, but leave the database alone otherwise. Another advantage of this pattern is you can use the migrations to update the tables of an existing table (as the name suggests).

Two different data sources in a Weblogic server

I have a Weblogic server configured in Eclipse with a local database as the data source. When debugging issues it would be nice to be able to connect to the database the test group is using. I thought I would be able to clone the default "myserver" in the default mydomain and create new data sources which point to the test groups database. I've done this but now I'm attempting to figure out how to start this new server and deploy my application to it through Eclipse.
I don't really care how it works, I just need to be able to easily switch between the two data sources, either through the Weblogic admin console or through eclipse via multiple servers. Being able to clone the current server would be nice since it's configuration is rather complex or just switch the sources out.
Any ideas on how to accomplish this would be much appreciated.
The JNDI name must be different, because it connects through the JNDI name Every data source should have unique JNDI name.

Generating database and connection from schema

I'm using Glassfish server 4.0 as my app server for a java project in NetBeans 7.3.1. I have a database schema which I would like to include in my server as a database. Is there a way to generate the database in Glassfish based on a previous schema?
The extensions of the files are .frm and there's one .opt file.
Also, does Glassfish include a visual interface to modify a database's table's properties and registries?
Thanks in advance.
The answer to your the last part of your question is no. Glassfish itself does not include a visual interface for modifying database tables, properties etc. It includes a visual interface for creating JDBC Connection Pools and JDBC Resources. I personally use one integrated into my IDE of choice, Netbeans may have this feature, I happen to use IDEA. In production you could use any 3rd party app that does this, TOAD being a popular one but there are many.
I have some thoughts on the first part of your question but nothing ready to put into an answer at this point. When I do I'll update this one if its still an open question.