Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

token refresh offset #12136

Merged
merged 33 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updates
  • Loading branch information
xiangyan99 committed Jun 24, 2020
commit 6d517685ce64cc0308e9c5f9b26b1962e12a2ae0
3 changes: 2 additions & 1 deletion sdk/identity/azure-identity/azure/identity/_authn_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def __init__(self, endpoint=None, authority=None, tenant=None, **kwargs): # pyl
authority = normalize_authority(authority) if authority else get_default_authority()
self._auth_url = "/".join((authority, tenant.strip("/"), "oauth2/v2.0/token"))
self._cache = kwargs.get("cache") or TokenCache() # type: TokenCache
self._token_refresh_retry_timeout = kwargs.get("token_refresh_retry_timeout", DEFAULT_TOKEN_REFRESH_RETRY_TIMEOUT) # default 30s
self._token_refresh_retry_timeout = kwargs.get("token_refresh_retry_timeout",
DEFAULT_TOKEN_REFRESH_RETRY_TIMEOUT) # default 30s
self._token_refresh_offset = kwargs.get("token_refresh_offset", DEFAULT_REFRESH_OFFSET) # default 2 min
self._last_refresh_time = 0

Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/azure-identity/tests/test_aad_client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ async def test_should_refresh():
assert not should_refresh


def test_token_refresh_kwargs():
async def test_token_refresh_kwargs():
client = AadClient("test", "test")
assert client._token_refresh_retry_timeout == DEFAULT_TOKEN_REFRESH_RETRY_TIMEOUT
assert client._token_refresh_offset == DEFAULT_REFRESH_OFFSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def test_should_refresh():
assert not should_refresh


def test_token_refresh_kwargs():
async def test_token_refresh_kwargs():
client = AsyncAuthnClient(endpoint="http://foo")
assert client._token_refresh_retry_timeout == DEFAULT_TOKEN_REFRESH_RETRY_TIMEOUT
assert client._token_refresh_offset == DEFAULT_REFRESH_OFFSET
Expand Down