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

Remove authentication_record property #11760

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,7 @@ def authenticate(self, **kwargs):
scopes = _DEFAULT_AUTHENTICATE_SCOPES[self._authority]

_ = self.get_token(*scopes, _allow_prompt=True, **kwargs)
return self.authentication_record # type: ignore

@property
def authentication_record(self):
# type: () -> Optional[AuthenticationRecord]
""":class:`~azure.identity.AuthenticationRecord` for the most recent authentication"""
return self._auth_record
return self._auth_record # type: ignore

@wrap_exceptions
def _acquire_token_silent(self, *scopes, **kwargs):
Expand Down
9 changes: 4 additions & 5 deletions sdk/identity/azure-identity/tests/test_browser_credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ def test_authenticate():
)
record = credential.authenticate(scopes=(scope,))

for auth_record in (record, credential.authentication_record):
assert auth_record.authority == environment
assert auth_record.home_account_id == object_id + "." + home_tenant
assert auth_record.tenant_id == home_tenant
assert auth_record.username == username
assert record.authority == environment
assert record.home_account_id == object_id + "." + home_tenant
assert record.tenant_id == home_tenant
assert record.username == username

# credential should have a cached access token for the scope used in authenticate
with patch(WEBBROWSER_OPEN, Mock(side_effect=Exception("credential should authenticate silently"))):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ def test_authenticate():
_cache=TokenCache(),
)
record = credential.authenticate(scopes=(scope,))
for auth_record in (record, credential.authentication_record):
assert auth_record.authority == environment
assert auth_record.home_account_id == object_id + "." + home_tenant
assert auth_record.tenant_id == home_tenant
assert auth_record.username == username
assert record.authority == environment
assert record.home_account_id == object_id + "." + home_tenant
assert record.tenant_id == home_tenant
assert record.username == username

# credential should have a cached access token for the scope used in authenticate
token = credential.get_token(scope)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,10 @@ def test_authenticate():
transport=transport,
)
record = credential.authenticate(scopes=(scope,))
for auth_record in (record, credential.authentication_record):
assert auth_record.authority == environment
assert auth_record.home_account_id == object_id + "." + home_tenant
assert auth_record.tenant_id == home_tenant
assert auth_record.username == username
assert record.authority == environment
assert record.home_account_id == object_id + "." + home_tenant
assert record.tenant_id == home_tenant
assert record.username == username

# credential should have a cached access token for the scope passed to authenticate
token = credential.get_token(scope)
Expand Down