Skip to content

Commit 54db1bf

Browse files
committed
Remove usage of "state" for code/token response.
1 parent 2904de6 commit 54db1bf

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

examples/skeleton_oauth2_web_application_server.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def validate_response_type(self, client_id, response_type, client, request, *arg
4848

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

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

6565
def validate_code(self, client_id, code, client, request, *args, **kwargs):
66-
# Validate the code belongs to the client. Add associated scopes,
67-
# state and user to request.scopes and request.user.
66+
# Validate the code belongs to the client. Add associated scopes
67+
# and user to request.scopes and request.user.
6868
pass
6969

7070
def confirm_redirect_uri(self, client_id, code, redirect_uri, client, request, *args, **kwargs):

oauthlib/oauth2/rfc6749/request_validator.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ def save_authorization_code(self, client_id, code, request, *args, **kwargs):
266266
- the redirect URI used (``request.redirect_uri``)
267267
- a resource owner / user (``request.user``)
268268
- the authorized scopes (``request.scopes``)
269-
- the client state, if given (``code.get('state')``)
270269
271270
To support PKCE, you MUST associate the code with:
272271
- Code Challenge (``request.code_challenge``) and
@@ -277,10 +276,6 @@ def save_authorization_code(self, client_id, code, request, *args, **kwargs):
277276
278277
``{'code': 'sdf345jsdf0934f'}``
279278
280-
It may also have a ``state`` key containing a nonce for the client, if it
281-
chose to send one. That value should be saved and used in
282-
``.validate_code``.
283-
284279
It may also have a ``claims`` parameter which, when present, will be a dict
285280
deserialized from JSON as described at
286281
http://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter
@@ -352,7 +347,7 @@ def save_bearer_token(self, token, request, *args, **kwargs):
352347
'expires_in': 3600,
353348
'scope': 'string of space separated authorized scopes',
354349
'refresh_token': '23sdf876234', # if issued
355-
'state': 'given_by_client', # if supplied by client
350+
'state': 'given_by_client', # if supplied by client (implicit ONLY)
356351
}
357352
358353
Note that while "scope" is a string-separated list of authorized scopes,
@@ -559,7 +554,6 @@ def validate_code(self, client_id, code, client, request, *args, **kwargs):
559554
with the code in 'save_authorization_code':
560555
561556
- request.user
562-
- request.state (if given)
563557
- request.scopes
564558
- request.claims (if given)
565559
OBS! The request.user attribute should be set to the resource owner

tests/openid/connect/core/grant_types/test_authorization_code.py

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ def test_no_prompt_authorization(self, generate_token):
116116

117117
def set_scopes(self, client_id, code, client, request):
118118
request.scopes = self.request.scopes
119-
request.state = self.request.state
120119
request.user = 'bob'
121120
return True
122121

0 commit comments

Comments
 (0)