|
12 | 12 | from oidcendpoint.client_authn import verify_client |
13 | 13 | from oidcendpoint.endpoint_context import EndpointContext |
14 | 14 | from oidcendpoint.exception import MultipleUsage |
| 15 | +from oidcendpoint.exception import ProcessError |
15 | 16 | from oidcendpoint.oidc import userinfo |
16 | 17 | from oidcendpoint.oidc.authorization import Authorization |
17 | 18 | from oidcendpoint.oidc.provider_config import ProviderConfiguration |
@@ -306,3 +307,23 @@ def test_do_2nd_refresh_access_token(self): |
306 | 307 | } |
307 | 308 | msg = self.endpoint.do_response(request=_req, **_resp) |
308 | 309 | assert isinstance(msg, dict) |
| 310 | + |
| 311 | + def test_do_refresh_access_token_not_allowed(self): |
| 312 | + areq = AUTH_REQ.copy() |
| 313 | + areq["scope"] = ["openid", "offline_access"] |
| 314 | + _cntx = self.endpoint.endpoint_context |
| 315 | + session_id = setup_session( |
| 316 | + _cntx, areq, uid="user", acr=INTERNETPROTOCOLPASSWORD |
| 317 | + ) |
| 318 | + _cntx.sdb.update(session_id, user="diana") |
| 319 | + _token_request = TOKEN_REQ_DICT.copy() |
| 320 | + _token_request["code"] = _cntx.sdb[session_id]["code"] |
| 321 | + _req = self.endpoint.parse_request(_token_request) |
| 322 | + _resp = self.endpoint.process_request(request=_req) |
| 323 | + |
| 324 | + self.endpoint.allow_refresh = False |
| 325 | + |
| 326 | + _request = REFRESH_TOKEN_REQ.copy() |
| 327 | + _request["refresh_token"] = _resp["response_args"]["refresh_token"] |
| 328 | + with pytest.raises(ProcessError): |
| 329 | + self.endpoint.parse_request(_request.to_json()) |
0 commit comments