/auth", "token_endpoint":"http://localhost/auth/realms/Test/protocol/openid-connect/token", " introspection_endpoint":"http://localhost/auth/realms/Test/protocol/openid-connect/token/introspect", ":"http://localhost/auth/realms/Test/protocol/openid-connect/logout", "jwks_uri":"http://localhost /auth #第一步登录 token_url = http://localhost/auth/realms/Test/protocol/openid-connect/token #第二步获取token api_url = http://localhost/auth/realms/Test/protocol/openid-connect/userinfo #第三部获取user信息 root_url
开发使用的接口文档: https://www.keycloak.org/docs-api/7.0/rest-api/index.html 此处为授权码方式的接口: 获取code:”/protocol/openid-connect /auth” [get] 获取token和刷新token:”/protocol/openid-connect/token” [post] 获取用户信息:”/protocol/openid-connect
curl --location 'http://localhost:9090/realms/MyAppRealm/protocol/openid-connect/token' \ --header 'Content-Type localhost:9090/realms/MyAppRealm jwk-set-uri: http://localhost:9090/realms/MyAppRealm/protocol/openid-connect
获取和刷新JWT 我们可以通过下面这个方式获取用户登录的JWT对: POST /auth/realms/felord.cn/protocol/openid-connect/token HTTP/1.1 refresh_token带上,把grant_type改为refresh_token就可以刷新Token对了,下面是请求刷新的报文: POST /auth/realms/felord.cn/protocol/openid-connect http://localhost:8080/foo/bar,你会发现浏览器会跳转到下面这个地址: http://localhost:8011/auth/realms/felord.cn/protocol/openid-connect
在 “Client Protocol”(客户端协议)字段中,选择要使用的协议,如 “openid-connect” 或 “saml”。 单击 “Save”(保存)按钮来保存客户端。 127.0.0.1:8080/realms/devrealm","authorization_endpoint":"http://127.0.0.1:8080/realms/devrealm/protocol/openid-connect ":"http://localhost:8080/auth/realms/devrealm/protocol/openid-connect/token/introspect","end_session_endpoint ":"http://127.0.0.1:8080/realms/devrealm/protocol/openid-connect/logout","jwks_uri":"http://localhost :8080/auth/realms/devrealm/protocol/openid-connect/certs","grant_types_supported":["authorization_code
http://192.168.8.10/auth/realms/master" jwksUri: "http://192.168.8.10/auth/realms/master/protocol/openid-connect client_id=istio" -d "grant_type=client_credentials" http://192.168.8.10/auth/realms/master/protocol/openid-connect
例如,我们可以使用 openid-connect 插件对接任意支持 OIDC 协议的认证服务,下面是一段对接到 Keycloak 服务的样例配置: curl http://127.0.0.1:9180/ apisix/admin/routes -H "X-Api-Key: your-API-key" -XPOST -d ' { "uri":"/*", "plugins":{ "openid-connect 针对 OIDC,APISIX 提供了 openid-connect 插件,可以用于对接支持了 OIDC 协议的认证服务。
测试token接口 获取接口的地址为: ip:port/auth/realms/icp/protocol/openid-connect/token 在这里,根据我们上面设置的地址信息,可以构造出token 的请求地址为: http://localhost:8080/auth/realms/xjjdog/protocol/openid-connect/token 使用curl来获取token。 password&scope=openid&username=xjjdog0&password=123456' http://localhost:8080/auth/realms/xjjdog/protocol/openid-connect curl -XPOST -d 'access_token={上面的token}' http://localhost:8080/auth/realms/xjjdog/protocol/openid-connect
redirect url) let token_url = TokenUrl::new(get_url_with_issuer( &config.issuer_url, "/protocol/openid-connect .unwrap(); let auth_url = AuthUrl::new(get_url_with_issuer( &config.issuer_url, "/protocol/openid-connect ( "{}/protocol/openid-connect/token",&self.config.issuer_url); let response = Client::new() .post
场景示例 开源的 API 网关 Apache APISIX 支持使用 openid-connect 插件对接以上身份认证服务,APISIX 会将所有未认证的请求重定向至身份认证服务的登录页,当登录成功后 目前 openid-connect 插件未提供自定义这部分配置的能力,因此可以使用 lua-resty-session 中提供的方法:通过 NGINX 变量的方式对其默认配置进行覆盖。
- cors - ip-restriction - ua-restriction - referer-restriction - uri-blocker - request-validation - openid-connect jwt-auth - kafka-logger - key-auth - limit-conn - limit-count - limit-req # - log-rotate # - node-status - openid-connect
如果不使用kubelogin等工具也可以直接通过curl获取token信息 curl -k 'https://keycloak.rocdu.top/auth/realms/master/protocol/openid-connect
中也没有就会把/admin/foo缓存到Cookie中,然后重定向到Keycloak授权页: http://localhost:8011/auth/realms/felord.cn/protocol/openid-connect
username, password): token_https = 'https://identity.dataspace.copernicus.eu/auth/realms/CDSE/protocol/openid-connect
Postman中使用Oauth2的方式调用接口就可以获取到Token了,获取token的地址:http://192.168.7.142:8080/auth/realms/macrozheng/protocol/openid-connect
limit-conn - limit-count - limit-req - loggly # - log-rotate - mocking # - node-status - opa - openid-connect
创建一个名为 kubernetes 的客户端,使用 openid-connect 协议对接。 curl -ks -X POST https://11.8.36.25/auth/realms/project-1/protocol/openid-connect/token \ -d grant_type curl -ks -X POST https://11.8.36.25/auth/realms/project-1/protocol/openid-connect/token \ -d grant_type
然后又重定向到: https://flydean-dev.onelogin.com/trust/openid-connect/v2?
springboot-client有一个接口/admin/foo,当未登录调用该接口时会转发到: http://localhost:8011/auth/realms/felord.cn/protocol/openid-connect
http://keycloak:8080/auth/realms/istio jwksUri: http://keycloak:8080/auth/realms/istio/protocol/openid-connect