-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose jwt in the policies context #718
Conversation
01cebd8
to
0ed50f1
Compare
t/apicast-policy-headers.t
Outdated
# Make fixtures policies available. There is a test that needs the "decode | ||
# oidc token" example policy. | ||
BEGIN { | ||
$ENV{TEST_NGINX_APICAST_POLICY_LOAD_PATH} = 't/fixtures/policies'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Fixed 👍
258c116
to
8470225
Compare
{ | ||
"issuer": "https://example.com/auth/realms/apicast", | ||
"config": { | ||
"public_key": "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALClz96cDQ965ENYMfZzG+Acu25lpx2KNpAALBQ+catCA59us7+uLY5rjQR6SOgZpCz5PJiKNAdRPDJMXSmXqM0CAwEAAQ==", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikz Ideas to avoid hardcoding it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do eval
filter and use Perl to read it and interpolate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could possibly work:
<<"JSON";
{
"oidc": ...
"public_key": "$::rsa"
}
JSON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 This is great 👍
This PR exposes jwt in the policies context in OAuth flows.
This is useful because it allows other policies to access those tokens. For example, the rate-limit policy ( #713 ) could benefit from this.
This PR also adds an integration test that uses OAuth and the headers policy and shows how it can set some headers with information extracted from the decoded jwt.