Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove usage of "state" for code/token response. #654

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

Merged
merged 2 commits into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/skeleton_oauth2_web_application_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def validate_response_type(self, client_id, response_type, client, request, *arg

def save_authorization_code(self, client_id, code, request, *args, **kwargs):
# Remember to associate it with request.scopes, request.redirect_uri
# request.client, request.state and request.user (the last is passed in
# request.client and request.user (the last is passed in
# post_authorization credentials, i.e. { 'user': request.user}.
pass

Expand All @@ -63,8 +63,8 @@ def authenticate_client_id(self, client_id, request, *args, **kwargs):
return False

def validate_code(self, client_id, code, client, request, *args, **kwargs):
# Validate the code belongs to the client. Add associated scopes,
# state and user to request.scopes and request.user.
# Validate the code belongs to the client. Add associated scopes
# and user to request.scopes and request.user.
pass

def confirm_redirect_uri(self, client_id, code, redirect_uri, client, request, *args, **kwargs):
Expand Down
8 changes: 1 addition & 7 deletions oauthlib/oauth2/rfc6749/request_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ def save_authorization_code(self, client_id, code, request, *args, **kwargs):
- the redirect URI used (``request.redirect_uri``)
- a resource owner / user (``request.user``)
- the authorized scopes (``request.scopes``)
- the client state, if given (``code.get('state')``)

To support PKCE, you MUST associate the code with:
- Code Challenge (``request.code_challenge``) and
Expand All @@ -277,10 +276,6 @@ def save_authorization_code(self, client_id, code, request, *args, **kwargs):

``{'code': 'sdf345jsdf0934f'}``

It may also have a ``state`` key containing a nonce for the client, if it
chose to send one. That value should be saved and used in
``.validate_code``.

It may also have a ``claims`` parameter which, when present, will be a dict
deserialized from JSON as described at
http://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter
Expand Down Expand Up @@ -352,7 +347,7 @@ def save_bearer_token(self, token, request, *args, **kwargs):
'expires_in': 3600,
'scope': 'string of space separated authorized scopes',
'refresh_token': '23sdf876234', # if issued
'state': 'given_by_client', # if supplied by client
'state': 'given_by_client', # if supplied by client (implicit ONLY)
}

Note that while "scope" is a string-separated list of authorized scopes,
Expand Down Expand Up @@ -559,7 +554,6 @@ def validate_code(self, client_id, code, client, request, *args, **kwargs):
with the code in 'save_authorization_code':

- request.user
- request.state (if given)
- request.scopes
- request.claims (if given)
OBS! The request.user attribute should be set to the resource owner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def test_no_prompt_authorization(self, generate_token):

def set_scopes(self, client_id, code, client, request):
request.scopes = self.request.scopes
request.state = self.request.state
request.user = 'bob'
return True

Expand Down