Skip to content

Commit afe9870

Browse files
committed
Merge branch 'oidc-mock-expires-in'
2 parents f3785be + 63ac387 commit afe9870

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

openeo/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.49.0a3"
1+
__version__ = "0.49.0a4"

openeo/rest/auth/testing.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import json
88
import urllib.parse
99
import uuid
10-
from typing import List, Optional
10+
from typing import Dict, List, Optional, Union
1111

1212
import requests
1313
import requests_mock.request
@@ -40,6 +40,7 @@ def __init__(
4040
device_code_flow_support: bool = True,
4141
oidc_discovery_url: Optional[str] = None,
4242
support_verification_uri_complete: bool = False,
43+
access_token_expires_in: Optional[int] = None,
4344
):
4445
self.requests_mock = requests_mock
4546
self.oidc_issuer = oidc_issuer
@@ -54,6 +55,7 @@ def __init__(
5455
self.state = state or {}
5556
self.scopes_supported = scopes_supported or ["openid", "email", "profile"]
5657
self.support_verification_uri_complete = support_verification_uri_complete
58+
self.access_token_expires_in = access_token_expires_in
5759
self.mocks = {}
5860

5961
oidc_discovery_url = oidc_discovery_url or url_join(oidc_issuer, "/.well-known/openid-configuration")
@@ -255,10 +257,12 @@ def _build_token_response(
255257
_uuid=uuid.uuid4().hex,
256258
),
257259
)
258-
res = {
260+
res: Dict[str, Union[str, int, float]] = {
259261
"token_type": "Bearer",
260262
"access_token": access_token,
261263
}
264+
if self.access_token_expires_in is not None:
265+
res["expires_in"] = self.access_token_expires_in
262266

263267
# Attempt to simulate real world refresh token support.
264268
if include_refresh_token is None:

0 commit comments

Comments
 (0)