Skip to content

Commit aa82dbc

Browse files
committed
test: Add test for ignore protected props in create session
1 parent 97e219c commit aa82dbc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/sessions/test_access_token_version.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,29 @@ async def test_should_validate_v3_tokens_with_check_database_enabled(app: TestCl
203203
}
204204

205205

206+
async def test_ignore_protected_props_in_create_session(app: TestClient):
207+
init(**get_st_init_args([session.init()])) # type:ignore
208+
start_st()
209+
210+
create_session_res = app.post("/create", data={"sub": "asdf"})
211+
212+
assert create_session_res.status_code == 200
213+
214+
info = extract_info(create_session_res)
215+
assert info["accessTokenFromAny"] is not None
216+
assert info["refreshTokenFromAny"] is not None
217+
assert info["frontToken"] is not None
218+
219+
parsed_token = parse_jwt_without_signature_verification(info["accessTokenFromAny"])
220+
assert parsed_token.payload["sub"] != "asdf"
221+
222+
s = await create_new_session_without_request_response(
223+
"public", "user-id", {"sub": "asdf"}
224+
)
225+
payload = parse_jwt_without_signature_verification(s.access_token).payload
226+
assert payload["sub"] != "asdf"
227+
228+
206229
async def test_validation_logic_with_keys_that_can_use_json_nulls_values_in_claims():
207230
"""We want to make sure that for access token claims that can be null, the SDK does not fail access token validation if the
208231
core does not send them as part of the payload. For this we verify that validation passes when the keys are None, empty,

0 commit comments

Comments
 (0)