Gets the JWT from the client cookie. :return: String representing the ID token
()
| 94 | |
| 95 | |
| 96 | def get_decoded_access_token_from_session() -> str or None: |
| 97 | """ |
| 98 | Gets the JWT from the client cookie. |
| 99 | :return: String representing the ID token |
| 100 | """ |
| 101 | oidc = OAuth2Provider() |
| 102 | oidc_client = oidc.get_client() |
| 103 | access_token = login_session.get('access_token') |
| 104 | if type(access_token) == str: |
| 105 | return access_token |
| 106 | if access_token is None: |
| 107 | return None |
| 108 | token_string = gzip.decompress(access_token).decode() |
| 109 | expired = oidc_client.id_token_has_expired(id_token = token_string) |
| 110 | if expired: |
| 111 | token_string = try_refreshing_tokens() |
| 112 | |
| 113 | return token_string |
| 114 | |
| 115 | |
| 116 | def try_refreshing_tokens() -> str or None: |
nothing calls this directly
no test coverage detected