Skip to content
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 @@ -37,7 +37,7 @@ def get_default_authority():
from .certificate_credential_base import CertificateCredentialBase
from .client_secret_credential_base import ClientSecretCredentialBase
from .exception_wrapper import wrap_exceptions
from .msal_credentials import InteractiveCredential, PublicClientCredential
from .msal_credentials import InteractiveCredential


def _scopes_to_resource(*scopes):
Expand All @@ -64,6 +64,5 @@ def _scopes_to_resource(*scopes):
"get_default_authority",
"InteractiveCredential",
"normalize_authority",
"PublicClientCredential",
"wrap_exceptions",
]
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,7 @@ def _create_app(self, cls):
return app


class PublicClientCredential(MsalCredential):
"""Wraps an MSAL PublicClientApplication with the TokenCredential API"""

@abc.abstractmethod
def get_token(self, *scopes, **kwargs): # pylint:disable=unused-argument
# type: (*str, **Any) -> AccessToken
pass

def _get_app(self):
# type: () -> msal.PublicClientApplication
if not self._msal_app:
self._msal_app = self._create_app(msal.PublicClientApplication)
return self._msal_app


class InteractiveCredential(PublicClientCredential):
class InteractiveCredential(MsalCredential):
def __init__(self, **kwargs):
self._disable_automatic_authentication = kwargs.pop("disable_automatic_authentication", False)
self._auth_record = kwargs.pop("authentication_record", None) # type: Optional[AuthenticationRecord]
Expand Down Expand Up @@ -246,3 +231,9 @@ def _acquire_token_silent(self, *scopes, **kwargs):
def _request_token(self, *scopes, **kwargs):
# type: (*str, **Any) -> dict
"""Request an access token via a non-silent MSAL token acquisition method, returning that method's result"""

def _get_app(self):
# type: () -> msal.PublicClientApplication
if not self._msal_app:
self._msal_app = self._create_app(msal.PublicClientApplication)
return self._msal_app