Skip to content

Instantly share code, notes, and snippets.

@DanukaPraneeth
Last active July 31, 2020 17:38
Show Gist options
  • Save DanukaPraneeth/55dc16f74ce7dd73a3156c5951c747d9 to your computer and use it in GitHub Desktop.
Save DanukaPraneeth/55dc16f74ce7dd73a3156c5951c747d9 to your computer and use it in GitHub Desktop.
Kong | JWT plugin Configs
oc create secret \
generic app-admin-jwt \
--from-literal=kongCredType=jwt \
--from-literal=key="admin-issuer" \
--from-literal=algorithm=RS256 \
--from-literal=rsa_public_key="-----BEGIN PUBLIC KEY-----
K9+fdfgdfgfgdfggdfggg4Q7rL15PejvkFEQx7m3TzWmm0sx9xukU8Gc49rYLxKv
CK5OO5vMnZ2v9yXBQwAp50LFrY28NflkQcJ0GU6WFnySQZErwn0DM0cDWsaRpfkW
-----END PUBLIC KEY-----"
---
apiVersion: configuration.konghq.com/v1
kind: KongConsumer
metadata:
name: admin
username: admin
credentials:
- app-admin-jwt
---
apiVersion: configuration.konghq.com/v1
kind: KongClusterPlugin
metadata:
name: app-jwt
plugin: jwt
---
oc patch ingress ingress-name -p '{"metadata":{"annotations":{"konghq.com/plugins":"app-jwt"}}}'
---
### When generating the JWT, Token's Claims must contain the secret’s key field as a Mandatory parameter(key field in the command used to generating the secrets)
# {
# "iss": "admin-issuer"
# }
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment