theGOTOguy / Oauth2-Mock-Server-Example

Example of getting auth tokens from the OAuth2 Mock server
MIT License
0 stars 0 forks source link

Scopes are not apparently passed along in the JWT #1

Open theGOTOguy opened 3 days ago

theGOTOguy commented 3 days ago

We would like to be able to test authorizing users with specific scopes, such as read or write. However, as far as I can tell, the output of

venv/bin/python example_auth.py

Does not include any such claim.

How do we include the requested scopes in the claims sent to the OAuth test server?

Example:

Listening on http://localhost:3001/callback for the authorization code...
127.0.0.1 - - [14/Nov/2024 16:52:06] "GET /callback?code=WOGZEfwkXnnOlHwmO3CDhsEJXlv9rkcUNvnkOiiUCrk HTTP/1.1" 200 -
Authorization code received: WOGZEfwkXnnOlHwmO3CDhsEJXlv9rkcUNvnkOiiUCrk
Listening on http://localhost:3001/callback for the authorization code...
{'token_type': 'Bearer', 'id_token': 'eyJraWQiOiJkZWZhdWx0IiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJ0ZXN0QHRlc3QuY29tIiwiYXVkIjoieW91cl9jbGllbnRfaWQiLCJuYmYiOjE3MzE2MjExMjYsImF6cCI6InlvdXJfY2xpZW50X2lkIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwL2RlZmF1bHQiLCJleHAiOjE3MzE2MjQ3MjYsImlhdCI6MTczMTYyMTEyNiwianRpIjoiNWM2OTQzNjMtYTMyNC00YzE0LWEyMGYtOWUxMDg5YjAxZmY2IiwidGlkIjoiZGVmYXVsdCJ9.ZSAhY3YwCL1QkZkzDS9BF56WRRNY-Y7bbDkkfzAagHMYVo6UC5jWKVISgOKlm_WpD_oiHJZTUzMN5nDRwn16Up4hM67ZOgx3KR1JmJwBBRUcW82C5K1PT3i2iibqG39Z8OF1a-Tt2ub_QWI-uRponfOzb1iCdMxwwhOBtdEuGFvP4CH_JiX-llItDJ9_UCKicu_iGW8Z9ZegQKsIVLQKVkcpJXCHG2ocweosVt6A5YBEEZfKd2B6xIDvTOfYJHVjG5LgKjkkog0Kqb__ceVysCqctDQD8a7oGkXai76vkuoOGUU-kr2pTRjxsMLQ6-h4XoH4wHkIbifghkhUeXR2ng', 'access_token': 'eyJraWQiOiJkZWZhdWx0IiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJ0ZXN0QHRlc3QuY29tIiwiYXVkIjoiZGVmYXVsdCIsIm5iZiI6MTczMTYyMTEyNiwiYXpwIjoieW91cl9jbGllbnRfaWQiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvZGVmYXVsdCIsImV4cCI6MTczMTYyNDcyNiwiaWF0IjoxNzMxNjIxMTI2LCJqdGkiOiJjMzBjZTE4ZS01Mjc2LTQ4NzItODRlMy00NDU3OGMzMjk1ZjciLCJ0aWQiOiJkZWZhdWx0In0.jaE3OGzWc9pkg3B0eYiXyEtqagUktLXlSaPU3nieoirHyNPWCfkM55nx2QMSXrit4N4fsqVYos3f6pvP7vP99UZRZmhemJnN4S2rYzow6QSO9d82CHSUy98s2wBflMnvV9Bv1e4OqMJP9UKyy_NxN-lc7Cg0j9EI69DjmLCpstYtqre0prQnxn5DbVH2flPxleVaPJMUmmQar0v1MP5B0JIM498NN5KFyvESY82D5G8YeKD4f5BIKPNxiGaNu9fb_T6AoJuH7d01l4YOotRtOP5waNYCtNmN4Mp3AaBljiJ3Dh4uqCmXaAxjVwhwlqLdzmeeqEUNWX9Irilp5N91VA', 'refresh_token': '263c40c9-f054-4b1c-8be6-1f8eaf469999', 'expires_in': 3599}
Access Token: eyJraWQiOiJkZWZhdWx0IiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJ0ZXN0QHRlc3QuY29tIiwiYXVkIjoiZGVmYXVsdCIsIm5iZiI6MTczMTYyMTEyNiwiYXpwIjoieW91cl9jbGllbnRfaWQiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvZGVmYXVsdCIsImV4cCI6MTczMTYyNDcyNiwiaWF0IjoxNzMxNjIxMTI2LC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uoOGUU-kr2pTRjxsMLQ6-h4XoH4wHkIbifghkhUeXR2ng
Decoded JWT: {'sub': 'test@test.com', 'aud': 'your_client_id', 'nbf': 1731621126, 'azp': 'your_client_id', 'iss': 'http://localhost:8080/default', 'exp': 1731624726, 'iat': 1731621126, 'jti': '5c694363-a324-4c14-a20f-9e1089b01ff6', 'tid': 'default'}
User Info: {'sub': 'test@test.com', 'aud': ['default'], 'nbf': 1731621126000, 'azp': 'your_client_id', 'iss': 'http://localhost:8080/default', 'exp': 1731624726000, 'iat': 1731621126000, 'jti': 'c30ce18e-5276-4872-84e3-44578c3295f7', 'tid': 'default'}