spring-cloud-dataflow
spring-cloud-dataflow copied to clipboard
required a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' that could not be found.
Description: Spring Cloud task trying to make a Oauth2 request to a resource server Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2024-01-23T14:17:10.578Z ERROR 299 --- [SDF-KG-DATAHARVESTER-SERVICE-TASK] [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
**Parameter 0 of method webClientTest in io.ontollogix.sdfkg.sdfkgdataharvesterservicetask.config.WebClientConfig required a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' in your configuration.**
Release versions: Spring boot - 3.2.2 - Spring Cloud task, and OAUTH2 Client
Custom apps:
Steps to reproduce: Application.yml spring security: oauth2: client: registration: keycloak: client-id: sdf-kg-dataharvester-client client-secret: authorization-grant-type: client_credentials scope: profile provider: keycloak: issuer-uri: ${sdfkg.security.endpointUrl}/realms/${sdfkg.security.realm} authorization-uri: ${sdfkg.security.endpointUrl}/realms/${sdfkg.security.realm}/protocol/openid-connect/auth token-uri: ${sdfkg.security.endpointUrl}/realms/${sdfkg.security.realm}/protocol/openid-connect/token user-info-uri: ${sdfkg.security.endpointUrl}/realms/${sdfkg.security.realm}/protocol/openid-connect/userinfo #end-session-uri: http://localhost:22002/realms/ontollogix-kg-sdf/protocol/openid-connect/logoutl user-name-attribute: email
Screenshots: Where applicable, add screenshots to help explain your problem.
Additional context: Spring Clould task running in a docker container and connecting to a spring boot service running on localhost and trying to call a service from Cloud task WebConfig @Bean public WebClient webClientTest(final ClientRegistrationRepository clientRegistrationRepository) {
var defaultClientCredentialsTokenResponseClient = new DefaultClientCredentialsTokenResponseClient();
// defaultClientCredentialsTokenResponseClient // .setRestOperations(getRestTemplateForTokenEndPoint(oauth2RegistrationId, tokenEndpointLogger)); var provider = OAuth2AuthorizedClientProviderBuilder.builder() .clientCredentials(c -> c.accessTokenResponseClient(defaultClientCredentialsTokenResponseClient)) .build(); var oauth2AuthorizedClientService = new InMemoryOAuth2AuthorizedClientService(clientRegistrationRepository);
var authorizedClientServiceOAuth2AuthorizedClientManager = new AuthorizedClientServiceOAuth2AuthorizedClientManager(clientRegistrationRepository, oauth2AuthorizedClientService);
authorizedClientServiceOAuth2AuthorizedClientManager.setAuthorizedClientProvider(provider);
var oauth = new ServletOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientServiceOAuth2AuthorizedClientManager);
oauth.setDefaultClientRegistrationId("keycloak");
return WebClient.builder()
// base path of the client, just path while calling is required
.apply(oauth.oauth2Configuration())
//.filter(logResourceRequest(resourceEndpointLogger, oauth2RegistrationId))
//.filter(logResourceResponse(resourceEndpointLogger, oauth2RegistrationId))
.build();
}
How is this related to Spring Cloud Data Flow? @mudduvenkatesh
The behaviour is recorded in spring cloud task. I can move this to the right issue group. Looking for you suggestion Regards
From: Corneil du Plessis @.> Date: Tuesday, January 23, 2024 at 9:58 AM To: spring-cloud/spring-cloud-dataflow @.> Cc: Venkatesh Muddu @.>, Mention @.> Subject: Re: [spring-cloud/spring-cloud-dataflow] required a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' that could not be found. (Issue #5650)
How is this related to Spring Cloud Data Flow? @mudduvenkateshhttps://github.com/mudduvenkatesh
— Reply to this email directly, view it on GitHubhttps://github.com/spring-cloud/spring-cloud-dataflow/issues/5650#issuecomment-1906229977, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAWAOYYTDCYKTCWKI6VJXGLYP7FZTAVCNFSM6AAAAABCHCYTQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBWGIZDSOJXG4. You are receiving this because you were mentioned.Message ID: @.***>
@mudduvenkatesh Which starters are you included in the list of dependencies? This does seem like a Spring Security specific issue.
Closing due to inactivity. If closed in error please let us know.