Openid-connect plugin not working

Folks i am a little confused when I set up a service a route and the openid connect plugin and try to access the endpoint (authn uri) I get a 302 - when I try this from postman or soupui I get no route or api message

HTTP/1.1 302 Moved Temporarily
Date: Thu, 19 Jul 2018 14:31:29 GMT
Content-Type: text/html
Content-Length: 167
Connection: keep-alive
Cache-Control: no-cache, no-store
Pragma: no-cache
Set-Cookie: authorization=G-rbFK5ggHtAWR05Dc2YvA…|1532011289|GKDf7mfiejmo5_Dn3bbeOZfd3_ssq1Gwu3r-3SDGiEO2wiNHwaxjYv2ZOtw5zNgQYTfmfXunlcKkfgz4LRNYSgQqHV5Bs1cpyCgizuAY7lQWmc-lzdozSTbKScE_MM53fYJChY_deV3YYenst7VsjpOWbwsHW-Uv7IWw916F9JssXXwHr6l6J17O4nltRed52JfLbWx_PuxfK7zcoyyu8A…|NCmZY9fA73UNW6KxdojUR9Kdtrg.; Path=/; HttpOnly
Location: http://keycloak-998463592.us-west-2.elb.amazonaws.com/auth/realms/quickstart/protocol/openid-connect/auth?response_type=code&state=-ZLmGiqAS8XK84UiTElApnC5&response_mode=query&redirect_uri=http%3A%2F%2Fresource.dc1x7x.dapaws.whitestartups.com%3A8000%2Fauthn&nonce=d5RgXigAl4k-D1bT9yV-yFGF&client_id=Kong-api-gateway-authn-service&code_challenge_method=S256&code_challenge=OvoKqV1VRanPQx9azHWtZC5VX5H9_tIq4hFxe5SW5Rw&scope=openid
Server: kong/0.32-enterprise-edition

I see that

dont worry about access token its for a sandbox poc environment

http://ec2-34-232-80-122.compute-1.amazonaws.com:8000/authn/?
0&access_token=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJGSjg2R2NGM2pUYk5MT2NvNE52WmtVQ0lVbWZZQ3FvcXRPUWVNZmJoTmxFIn0.eyJqdGkiOiI2NGZhZWNmYy00ZWExLTQyNzEtOTlmNS0wZDZiNjhlMDkwZDgiLCJleHAiOjE1MzIwMDk0MjIsIm5iZiI6MCwiaWF0IjoxNTMyMD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b25nLWFwaS1nYXRld2F5LWF1dGhuLXNlcnZpY2UiLCJjbGllbnRBZGRyZXNzIjoiMTAuMTE4LjEyLjIwMSIsImVtYWlsIjoic2VydmljZS1hY2NvdW50LWtvbmctYXBpLWdhdGV3YXktYXV0aG4tc2VydmljZUBwbGFjZWhvbGRlci5vcmcifQ.AEtWSgfYuDFbAFn9YKU9TwyHG6JteBpT83p96SJCRT3zqoxVHQh1fQJsXn37uQcxBKUTcd5fxuCIvE6tdLRE

I tcp dumped the traffic and I see nothing routed to keycloak

root@ip-10-239-5-147:~# ./authn.sh
HTTP/1.1 302 Moved Temporarily
Date: Thu, 19 Jul 2018 14:31:29 GMT
Content-Type: text/html
Content-Length: 167
Connection: keep-alive
Cache-Control: no-cache, no-store
Pragma: no-cache
Set-Cookie: authorization=G-rbFK5ggHtAWR05Dc2YvA…|1532011289|GKDf7mfiejmo5_Dn3bbeOZfd3_ssq1Gwu3r-3SDGiEO2wiNHwaxjYv2ZOtw5zNgQYTfmfXunlcKkfgz4LRNYSgQqHV5Bs1cpyCgizuAY7lQWmc-lzdozSTbKScE_MM53fYJChY_deV3YYenst7VsjpOWbwsHW-Uv7IWw916F9JssXXwHr6l6J17O4nltRed52JfLbWx_PuxfK7zcoyyu8A…|NCmZY9fA73UNW6KxdojUR9Kdtrg.; Path=/; HttpOnly
Location: http://keycloak-998463592.us-west-2.elb.amazonaws.com/auth/realms/quickstart/protocol/openid-connect/auth?response_type=code&state=-ZLmGiqAS8XK84UiTElApnC5&response_mode=query&redirect_uri=http%3A%2F%2Fresource.dc1x7x.dapaws.whitestartups.com%3A8000%2Fauthn&nonce=d5RgXigAl4k-D1bT9yV-yFGF&client_id=Kong-api-gateway-authn-service&code_challenge_method=S256&code_challenge=OvoKqV1VRanPQx9azHWtZC5VX5H9_tIq4hFxe5SW5Rw&scope=openid
Server: kong/0.32-enterprise-edition

302 Found

302 Found


openresty/1.13.6.2

Have you found an answer to this question yet? Since OpenID Connect is an enterprise plugin you might have access to support via the support portal as well. Just want to make sure you’re not stuck if you have access to support!

ahh i figured it out its actually working - brain glitch a 302 on a preotected api is exactly whats required if yopu use postman or soapui - it works

tis a trick thiing trying to follow whats an api whats a service and how they all route via a route

a paragraph in emglish would go a long way

Then EE OpenID Connect Plugin falls back to authorization code flow if you don’t give it any credentials (that it can use) on request. If you remove authorization_code from plugins config.auth_methods then it will give you 401 — Unauthorized (as there is no fallback anymore).

Thanks - its actually pretty snazzy once you get it working - basically i am protecting three web services

authz autha and authk … kinda neat now I have the first latch - via keycloak and glue and cognito federated together and offering fallback on each other , the second latch verification via abstracted authz/openid connect end point for token verification and jwt introspection using scope and claims authorization - uma basically

kong needs to do some work on its jwe jws compatability - im having to offload this all of the jws and jwe work out to gluu via abastracted endpoints , auditing is done via keycloak and amazon - off to kafka and then the elkstack but its really neat to see all this opensource working together - i can use the comumunity fgateway and the nokia plugin to do same thing but im going to use elasticache to make it fly and I thought the enterprise edition was worth demoing

@thomas_mcavoy regarding your point

a paragraph in emglish would go a long way

We welcome pull requests to improve our documentation - now that you’ve come to understand how things work, perhaps you’ll be able to add a sentence or two that helps future users! See https://github.com/Kong/docs.konghq.com/blob/master/CONTRIBUTING.md

Thanks Cooper - i understand how this all works - money has to come from somewhere …

ok Ill fix the documentation this weekend the issue is that the product is in flight and you guys need to put a couple of diagrams in place

ive worked with datapower, vordel , away and a whole ton of comercial gateways so i can plough throgh this at nights and weekends

  1. what is a route - is it a route to the kong api endpoint on the server or is a route from a service to an outgoing service

  2. a service seems to be a placehilder for an outgoing endpoint but maybe maybe not , cause you need a route for it to work which goes back to 1

  3. if I create an api , then a service with the same path who wins …

a diagram would help - i got this working but … blinding people so you can charge for guidance just doesnt seem right to me

Hello Thomas,

I’m sorry about the trouble you are having. Let me try to clarify your questions.

a service seems to be a placeholder for an outgoing endpoint but maybe maybe no.

Kong routes requests from a user to a Service. In general, Services are usually APIs to which Kong acts as a proxy.

There are a couple wrinkles to it:

  • when doing load balancing, a single Service can end up pointing to several upstream services/machines.
  • when using custom plugins, requests can potentially be sent off anywhere.

We use the term “endpoint” to refer to “paths inside a Service”, not for servers.

what is a route

A single Kong instance can be used to proxy to many different Services. When a request arrives, Kong needs to determine to which Service it should sent it to.

Routes are the rules by which Kong makes these decisions: they do the “mapping”. Each route belongs to a single service, and a service can have many routes.

a diagram would help

Ok. So this is how Routes relate to Services.


                +---------- Kong ----------+
          "b"   |  Route a ----> Service 1 |
  client -----> |  Route b ----> Service 1 | ----> Service 1
                |  Route c ----> Service 2 |
                +--------------------------+

Since Kong can make changes to a request before sending it to the service, and changes to the responses before sending them back to the users, we differentiate between “requests” and “service requests”. And same with “response” and “service responses”

        1. request        2. service request 
      -------------->      --------------->
user                  Kong                  Service
      <--------------      <---------------
        4. response       3. service response

I hope this helps.

if I create an api , then a service with the same path who wins

API is a deprecated entity. We split API entity to Route and Service. Think about Service being upstream_url of API entity. Route will be matched before API so that you can migrate from APIs to Routes and Services without needing to delete APIs.

kong needs to do some work on its jwe jws compatability

We don’t currently support JWE (in our EE OpenID Connect Plugin), but what kind of work do you suggest us to do on JWS?

Firstly thank-you both for the replies this clears up just about everything ,
I guess I really need to check what algorithms and cypher mechanism are used and currently supported
before making bold statements …

Signature verification should work with RS256, RS512, PS256, PS384, PS512, ES256, ES384, ES512, HS256, HS384, HS512. I would use asymmetric crypto as it makes it easier to share and rotate public keys (vs. shared secret).

At the moment we only support compact serialization of JWS.