(self, token, request: OAuth2Request)
| 58 | raise NotImplementedError() |
| 59 | |
| 60 | def encode_id_token(self, token, request: OAuth2Request): |
| 61 | alg = self.get_client_algorithm(request.client) |
| 62 | header = self.get_encode_header(request.client) |
| 63 | |
| 64 | claims = self.get_compatible_claims(request) |
| 65 | if request.authorization_code: |
| 66 | claims.update( |
| 67 | self.get_authorization_code_claims(request.authorization_code) |
| 68 | ) |
| 69 | |
| 70 | access_token = token.get("access_token") |
| 71 | if access_token: |
| 72 | at_hash = create_half_hash(access_token, alg) |
| 73 | if at_hash is not None: |
| 74 | claims["at_hash"] = at_hash.decode("utf-8") |
| 75 | |
| 76 | user_info = self.generate_user_info(request.user, token["scope"]) |
| 77 | claims.update(user_info) |
| 78 | |
| 79 | if alg == "none": |
| 80 | private_key = None |
| 81 | else: |
| 82 | key = self.resolve_client_private_key(request.client) |
| 83 | private_key = import_any_key(key) |
| 84 | |
| 85 | return jwt.encode(header, claims, private_key, [alg]) |
| 86 | |
| 87 | def process_token(self, grant, response): |
| 88 | _, token, _ = response |
no test coverage detected