Skip to content

Commit

Permalink
Remove authentication_record property (#11760)
Browse files Browse the repository at this point in the history
  • Loading branch information
chlowell authored Jun 2, 2020
1 parent 5a40b24 commit 63497ae
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
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

0 comments on commit 63497ae

Please sign in to comment.