Comments (6)
@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.
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.
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.
by 'the credential value' you mean the 'api key'?
from kong-js-pdk.
credential
in this context means an abitrary identitifer that your internal auth system returns, that can uniquely
identifier a user.
from kong-js-pdk.
cool, perfect! This simplify things A LOT!
Thanks
from kong-js-pdk.
Related Issues (20)
- How to convert the response obtained from getRawBody() to a readable format ? HOT 2
- package.json no longer includes files for plugin_test.js HOT 1
- Incorrect assignment of mocked log functions in plugin_test.js
- Server tries to load all files in the folder as a plugin and fails to start HOT 3
- Problem reading gzipped kong.service.response.get_raw_body() HOT 11
- Modifying response body (no body_filter phase?) HOT 3
- Question: How to wrote Unit tests using plugin_test.js HOT 1
- How to cache stuff? HOT 1
- Issues running tests HOT 4
- Question: How to see plugin error inside docker container logs HOT 2
- Missing plugin socket HOT 2
- Critical severity alert on msgpack dependency HOT 2
- Accessing Binary Files in plugin HOT 3
- How to add X-Kong-Upstream-Status header to response HOT 4
- Share Data between Plugins in Kong JS PDK HOT 2
- How to set no_consumer flag with kong-js-pdk Schema HOT 4
- Reference to a incorrect module functions HOT 3
- Kong unable to load js plugin HOT 10
- Simplify Module Loading HOT 7
- Plugin Test Case - Cannot use import statement outside a module error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kong-js-pdk.