Code Monkey home page Code Monkey logo

Comments (6)

fffonion avatar fffonion commented on August 12, 2024

@akira28 I don't immeditately see a way to do it without touching DB directly (or admin API), and that could be ugly. However
i can see this usage being common, actually plugins like openid, oauth2 has the same requirement. But instead of actually create a consumer
you can use kong.client.authenticate(consumer, credential) to tell Kong the credential it mapped to. And plugins like rate-limit also honors
credential without the need to lookup consumer. But don't set consumer, since it's not a consumer mapped anyway.

from kong-js-pdk.

akira28 avatar akira28 commented on August 12, 2024

ah, nice to know. But how can I create the 'credential' object? And can I call kong.client.authenticate(undefined, credential) (undefined consumer)?

from kong-js-pdk.

fffonion avatar fffonion commented on August 12, 2024

Yes you can. On Lua PDK I think credential is just an table of { id = "the credential value" }, it would work with
proper Js syntax, though i didn't try for myself.

from kong-js-pdk.

akira28 avatar akira28 commented on August 12, 2024

by 'the credential value' you mean the 'api key'?

from kong-js-pdk.

fffonion avatar fffonion commented on August 12, 2024

credential in this context means an abitrary identitifer that your internal auth system returns, that can uniquely
identifier a user.

from kong-js-pdk.

akira28 avatar akira28 commented on August 12, 2024

cool, perfect! This simplify things A LOT!
Thanks

from kong-js-pdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.