Skip to content
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

Fix authlib.oauth2.rfc9068.JWTIntrospectionEndpoint documentation mistakes #642

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

twalcari
Copy link

A small fix to the documentation of authlib.oauth2.rfc9068.JWTIntrospectionEndpoint

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

  • You consent that the copyright of your pull request source code belongs to Authlib's author.

@twalcari
Copy link
Author

Hi @azmeuk , can you clarify why the documentation of authlib.oauth2.rfc9068.JWTIntrospectionEndpoint mentioned:

authorization_server.register_endpoint(MyRefreshTokenIntrospectionEndpoint)

That class MyRefreshTokenIntrospectionEndpoint is not mentioned in the code example. Does that line need to be removed, or must that class MyRefreshTokenIntrospectionEndpoint be added to the documentation?

The same issue arises for the authlib.oauth2.rfc9068.JWTRevocationEndpoint by the way.

@azmeuk azmeuk self-requested a review April 10, 2024 13:45
@@ -20,7 +20,7 @@ class JWTIntrospectionEndpoint(IntrospectionEndpoint):

::

class MyJWTAccessTokenIntrospectionEndpoint(JWTRevocationEndpoint):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one is definitively an error. 👍

@azmeuk
Copy link
Collaborator

azmeuk commented Apr 16, 2024

The MyRefreshTokenIntrospectionEndpoint is not mentionned in the code, I simply added this to illustrate that there can be several introspection endpoints for different kinds of token (jwt or refresh for instance).

If several introspection endpoints are registered with register_endpoint, the first one will be executed. If a ContinueIteration exception is raised, then the second registration endpoint is executed and so on. Practically, when JWTIntrospectionEndpoint gets a refresh token, it passes it to the next registered introspection endpoint by raising a ContinueIteration.

# do not attempt to decode refresh_tokens
if request.form.get('token_type_hint') not in ('access_token', None):
raise ContinueIteration()

This behavior has been introduced with #576 but not documented. I am opened to ideas for making the documentation clearer about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants