如何解决使用 jwks 验证令牌
我正在尝试在 GKE 集群上设置 Kong,以便我可以验证传入的请求。我有一个 jwks 文件/uri,我想用于验证。
我已按照以下步骤...
-
部署一个通过服务公开的 hello world 应用。
-
安装Kong
kubectl apply -f https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/master/deploy/single/all-in-one-dbless.yaml
-
设置 Kong JWT 插件
apiVersion: configuration.konghq.com/v1 kind: KongPlugin Metadata: name: weather-jwt namespace: weather-api plugin: jwt
-
创建入口
apiVersion: networking.k8s.io/v1beta1 kind: Ingress Metadata: name: weather-ingress namespace: weather-api annotations: kubernetes.io/ingress.class: kong plugins.konghq.com: weather-jwt spec: backend: serviceName: weather-service servicePort: 80
我看到的下一步是..
-
创建一个具有类似公钥的秘密
apiVersion: v1 kind: Secret Metadata: name: apiuser-apikey namespace: weather-api type: Opaque stringData: kongCredType: jwt key: https://farrellsoft.auth0.com/ algorithm: RS256 rsa_public_key: |- -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3PYgeiVyURLhqAkkUOfL roY281upGVWgBTZKZu6rIMPCiyzuZU8Rnlc1k+cHkbov0uRZIVmwrhMLTr6E9ZwD -----END PUBLIC KEY-----
-
创建kong消费者
apiVersion: configuration.konghq.com/v1 kind: KongConsumer Metadata: name: api-consumer namespace: weather-api username: apiUser credentials: - apiuser-apikey
这应该一切正常...问题是我没有秘密的公钥。我所拥有的只是 JWKS uri 之类的 https://YOUR_DOMAIN/.well-kNown/jwks.json
并且我不确定如何使用它进行令牌验证。有没有我需要使用的其他插件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。