I have a spring boot application using spring-boot-starter-oauth2-client
. I want to hide my client secret in the application configuration file like :
spring:
security:
oauth2:
client:
registration:
keycloak:
client-id: service-a
# this works
client-secret: f4585c52-d30d-4247-b252-bfe61646efb0
# this does not work
client-secret: '{bcrypt}$2a$10$Q3FMa0KqtROryjqhjXlzueLGzfnQBb.OGp17AO.i/Bs3T9s7CqqBO'
authorization-grant-type: client_credentials
client-authentication-method: BASIC
When I use {bcrypt}
I get:
org.springframework.security.oauth2.client.ClientAuthorizationException: [invalid_token_response]
An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response:
401 Unauthorized: [no body]] with root cause
Is it possible to do so ? And if yes what configuration should I add to make it work ?
I already tried to add the BCryptPasswordEncoder
bean without any success.