问题
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
回答1:
Try the config.anonymous
field in the key-auth plugin I think by:
creating a consumer that you can call ‘anoynmous’ with and id 0 for example
use the kong id of that consumer in anonymous field
update your custom code (KongAuthentication) and check if HTTP_X_CONSUMER_CUSTOM_ID = 0 then return AnonymousUser (django.contrib.auth.models.AnonymousUser)
来源:https://stackoverflow.com/questions/51242617/same-endpoint-for-anonymous-and-authenticated-users