Skip to content

oauth2: add "default_expires_in" config option#14625

Closed
riptl wants to merge 4 commits intoenvoyproxy:mainfrom
riptl:oauth-default-expire-in
Closed

oauth2: add "default_expires_in" config option#14625
riptl wants to merge 4 commits intoenvoyproxy:mainfrom
riptl:oauth-default-expire-in

Conversation

@riptl
Copy link
Copy Markdown
Contributor

@riptl riptl commented Jan 11, 2021

Signed-off-by: Richard Patel me@terorie.dev

Commit Message: oauth2: add "default_expires_in" config option
Additional Description: Fixes compatibility with OAuth 2.0 authorization servers that don't provide the "expires_in" property in the token response
Risk Level: Low
Testing: Added OAuth client tests for two new branches (default expires_in, missing default or explicit expires_in)
Docs Changes: Inline API proto
Release Notes: oauth2 filter: added "default_expires_in" property for authorization servers that don't provide the "expires_in" token response property
Fixes #14254

@repokitteh-read-only
Copy link
Copy Markdown

Hi @terorie, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #14625 was opened by terorie.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
API shepherd assignee is @markdroth
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #14625 was opened by terorie.

see: more, trace.

@riptl riptl changed the title oauth2: WIP add "default_expires_in" config option oauth2: add "default_expires_in" config option Jan 11, 2021
Comment thread source/extensions/filters/http/oauth2/oauth_client.h Outdated
Comment thread source/extensions/filters/http/oauth2/oauth_client.h Outdated
@riptl riptl marked this pull request as ready for review January 11, 2021 02:08
riptl added 2 commits January 11, 2021 05:43
Signed-off-by: Richard Patel <me@terorie.dev>
Signed-off-by: Richard Patel <me@terorie.dev>
@riptl riptl force-pushed the oauth-default-expire-in branch from 90dd0a3 to b7854e2 Compare January 11, 2021 06:21
@markdroth
Copy link
Copy Markdown
Contributor

/lgtm api

Base automatically changed from master to main January 15, 2021 23:02
@rgs1
Copy link
Copy Markdown
Member

rgs1 commented Feb 15, 2021

cc: @williamsfu99

Signed-off-by: Richard Patel <me@terorie.dev>
Signed-off-by: Richard Patel <me@terorie.dev>
@riptl riptl force-pushed the oauth-default-expire-in branch from 67ca4bc to 80ba2ff Compare February 16, 2021 00:37
@riptl
Copy link
Copy Markdown
Contributor Author

riptl commented Feb 16, 2021

I merged in the latest changes of main. I think the code is fine but CI is failing in unrelated parts.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions Bot added the stale stalebot believes this issue/PR has not been touched recently label Mar 18, 2021
@github-actions
Copy link
Copy Markdown

This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions Bot closed this Mar 25, 2021
@riptl
Copy link
Copy Markdown
Contributor Author

riptl commented Mar 25, 2021

@rgs1 @williamsfu99 Can we re-open this? The underlying issue still remains. I will rebase asap

if (response.has_expires_in()) {
expires_in = std::chrono::seconds{response.expires_in().value()};
}
if (expires_in <= 0s) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This inherently adds a check that the response's expires_in field doesn't contain some logically invalid negative duration. Probably a good thing to send a local reply instead of setting client cookies etc.

expires_in = std::chrono::seconds{response.expires_in().value()};
}
if (expires_in <= 0s) {
ENVOY_LOG(debug, "No default or explicit access token expiration after asyncGetAccessToken");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - "No valid default or explicit token expiration value found after asyncGetAccessToken"

Copy link
Copy Markdown
Contributor

@williamsfu99 williamsfu99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add some comments in docs/root/configuration/http/http_filters/oauth2_filter.rst explaining/giving examples of the new feature?

@dio
Copy link
Copy Markdown
Member

dio commented Sep 23, 2021

@terorie @williamsfu99 @rgs1 Do you think we need to revive this to solve #14542? It seems like there are small nits to be resolved to bring this in. I can try to help if that makes sense.

cc. @orHayoun

@riptl
Copy link
Copy Markdown
Contributor Author

riptl commented Sep 23, 2021

@dio Sorry I've completely forgot about this. I'm not using the OAuth2 filter anymore so feel free to close from my side. I'm happy to finish up the PRs if the functionality is wanted though.

@dio
Copy link
Copy Markdown
Member

dio commented Sep 24, 2021

@terorie no worries 🙂. From my reading, I think this PR is solving that issue and required. Please let me know if you want me to reopen this. Thank you!

@riptl
Copy link
Copy Markdown
Contributor Author

riptl commented Oct 3, 2021

I'm struggling at the moment to revive my workspace because the dev container is currently broken: #18388
So I probably won't be able to finish this PR this week. Sorry about that.

@DiamondJoseph
Copy link
Copy Markdown

@dio I would appreciate it being re-opened as the issue is still causing problems
@terorie it looks like the dev container has been fixed, if it's possible to get this over the line I would really appreciate.

If it's purely nitpicks I may be able to help, but I have not used C languages before.
/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #14625 (comment) was created by @DiamondJoseph.

see: more, trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api stale stalebot believes this issue/PR has not been touched recently

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants