4

I want to add this endpoint /graphql in kong for both anonymous and authenticated users :

  • if the apikey is provided consider it as authenticated
  • othwerwise consider it as anonymous
sel_space
  • 187
  • 2
  • 12

1 Answers1

3

Try the config.anonymous field in the key-auth plugin I think by:

  1. creating a consumer that you can call ‘anoynmous’ with and id 0 for example

  2. use the kong id of that consumer in anonymous field

  3. update your custom code (KongAuthentication) and check if HTTP_X_CONSUMER_CUSTOM_ID = 0 then return AnonymousUser (django.contrib.auth.models.AnonymousUser)

sel_space
  • 187
  • 2
  • 12
mou55
  • 660
  • 1
  • 8
  • 13