I am using the application in two instances that have different database passwords. My code only needs to access and query one instance, and doesn't need to access database on another instance. If I try to deploy the app with wrong password, it gives me "password authentication" error and doesn't start the application.
I want the app to ignore the database connection if password authentication is failed.
Here is my application.properties file.
spring.security.enabled=false
management.security.enabled=false
security.basic.enabled=false
## Postgresql for storing backup details
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url= jdbc:postgresql://localhost:5432/dbName
spring.datasource.username=username
spring.datasource.password=password
#spring.datasource.continue-on-error=true
#spring.datasource.initialize=false
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQL94Dialect
spring.datasource.primary.continueOnError=true
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
Spring boot version is 1.5.9
You can run spring boot application without datasource. For that you must disable the auto configuration of datasource and probably the JPA auto configuration as well. Place the below line in your #SpringBootApplication
#EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
Related
I am new to Liquibase. I have gotten the hang of what I need to do for now. But I would like to know is there a way to encrypt the password we store in the property spring.liquibase.password in the application.properties file of a Spring Boot application?
I have a small doubt. I need to connect Spring Cloud Config Server with JDBC Backend. But the credentials to connect to the DB aren’t readily available. The real password has to be retrieved from Cyberark using a nickname and I have relevant Java Code for the same. I need a mechanism where this deciphered Password and Username can be used for setting the datasource of the Spring Cloud Config Server. Is this possible?
new spring boot application using spring data jpa and we need to connect oracle DB without password set in spring.datasource.password instead need to use connectionProperties with javax.net.ssl.truststore file and javax.net.ssl.truststorePassword.
please help me how we can go with approach to connect DB with spring data jpa?
existing application used same without DB password but used certificate to connect DB in jdbc template.
spring.datasource.url
spring.datasource.driverClassName
spring.datasource.username
// No DB password here but we need to use certificates
javax.net.ssl.truststore = load cert file from file path
javax.net.ssl.trustStoreType
javax.net.ssl.truststorePassword = load encrypted cert password from file path
Can you check the details in the blog? You do need the password along with the certificate. Certificate is to enable stronger security with SSL but not to eliminate database password.
You can leave oracle bound to localhost and use SSH tunnel on spring to connect to it.
On the Oracle server use key to connect ssh instead of password.
Check out this: https://stackoverflow.com/a/71766760/4903232
here i am trying to get a list with users from keycloak.
it works withe docker compose, but not in openshift?!
my application.property
keycloak.enabled=true
keycloak.realm=somname
keycloak.ssl-required=none
keycloak.resource=someapp
keycloak.public-client=true
keycloak.auth-server-url=${KEYCLOAK_AUTH-SERVER-URL:https://localhost/auth}
keycloak.disable-trust-manager=true
app.connectors.KeyCloakAdminConnector.serverUri=${KEYCLOAK_ADMIN-URL:http://idm.local:8081/auth}
app.connectors.KeyCloakAdminConnector.realm=${keycloak.realm}
app.connectors.KeyCloakAdminConnector.username=admin
app.connectors.KeyCloakAdminConnector.password=pass
app.connectors.KeyCloakAdminConnector.clientId=${keycloak.resource}
As a solution i changed the:
keycloak-admin-url: 'my-keycloak-route/auth'
in application.property to
keycloak-admin-url: 'http://myservice-keycloak-http:8080/auth'
so i change the connection between the Spring boot App and Keycloack from Rout-Object to a Service-Object.
its works because Service is not https. so i dont need to provide a certificate to JVM keytrust in the Spring boot App
I create a Spring Cloud Config server. I put security in my application.properties file
security.basic.enabled=false
security.user.name=1user
security.user.password=123
When I try to log to the application with the name and password, I always get
Bad credentials
I tried to put enabled to true but get same result. I saw in the command line then spring generate random password like
69dfeb52-6320-4085-bcd1-22ee7a3676a2
if I use with with username user, I can connect.
>
Hi Robert Trudel
If you are using Spring Boot 2.x, then you need to prefix these properties with spring
as shown below:
spring.security.user.name=1user
spring.security.user.password=123
Also, you do not need this security.basic.enabled=false.
Hope this helps!