Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
credential wrapping MSAL public application
  • Loading branch information
chlowell committed Jul 30, 2019
commit 6929968a5ebd7d9fa49dccc0b42cc3ee2d5c0e0f
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from .msal_credentials import ConfidentialClientCredential
from .msal_transport_adapter import MsalTransportResponse, MsalTransportAdapter
from .msal_credentials import ConfidentialClientCredential, PublicClientCredential
from .msal_transport_adapter import MsalTransportAdapter, MsalTransportResponse
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,11 @@ def get_token(self, *scopes):
raise ClientAuthenticationError(message="authentication failed: {}".format(result.get("error_description")))

return AccessToken(result["access_token"], now + int(result["expires_in"]))


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

def __init__(self, **kwargs):
# type: (Any) -> None
super(PublicClientCredential, self).__init__(app_class=msal.PublicClientApplication, **kwargs)