我有一个带Keycloak的安全架构(模式参见Securing thorntail service with KEYCLOAK )。它工作得很好。但是现在,我不知道如何让服务A单独从安全服务B获取一些信息。
如果流是启动(已验证,因此具有令牌)/服务A/安全服务B,则Ok,A访问B。但是,例如,在早上第一次启动(@ FrontEnd )服务A需要从服务B获取一些信息,没有要转发的令牌……该怎么做呢?
发布于 2020-05-13 16:30:15
客户端凭据流是您所需要的。https://www.keycloak.org/docs/latest/authorization_services/#_service_protection_permission_api_papi
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'grant_type=client_credentials&client_id=${client_id}&client_secret=${client_secret}' \
"http://localhost:8080/auth/realms/${realm_name}/protocol/openid-connect/token"
这来自密钥罩文档(https://www.keycloak.org/docs/latest/authorization_services/#_service_protection_permission_api_papi)。
还要检查这个:https://auth0.com/docs/flows/concepts/client-credentials
https://stackoverflow.com/questions/61752924
复制相似问题