Use Keycloak as multi provider for token validation

Hi all.

I’m new to keycloak and also with services like Keycloak and I’m reading the docs to trying to figure it out if something that I want it’s possible.

I’d like to have 2 identity providers, e.g.:

Keycloak will be my main provider (some users will be here)

External provider will be my second provider (I’ll receive the bearer token directly)

So the idea is:

The resource server will receive the Bearer Token, sometimes is a Keycloak token, sometimes is an external token.

Is it possible to delegate every token to keycloak and it discovers which is the provider and validate against them?

Bearer Token from Keycloak: 1234
Bearer Token from external provider: 5678

Client (sends Bearer 1234) -> Resource Server (Spring Boot MS) -> Keycloak -> Valid Token

Client (sends Bearer 5678) -> Resource Server (Spring Boot MS) -> Keycloak -> Valid Token in External Provider

Thank in advance