Skip to content

Commit 5106e0d

Browse files
author
docsreference@microsoft.com
committed
CI Update
Build.Reason:Manual by Jiali Yang (Learn) Build.Url:https://apidrop.visualstudio.com/Content%20CI/_build/results?buildId=583196&view=results
1 parent 85bf185 commit 5106e0d

6 files changed

Lines changed: 2048 additions & 263 deletions

python/docs-ref-autogen/msal/msal.application.ClientApplication.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ constructor:
6666
: [], \"backrefs\": [], \"xml:space\": \"preserve\", \"language\": \"default\"\
6767
, \"force\": false, \"linenos\": false} -->\n\n````default\n\n {\n \"\
6868
client_assertion\": \"...a JWT with claims aud, exp, iss, jti, nbf, and sub...\"\
69-
\n }\n ````\n\n\n\n## Supporting reading client cerficates from PFX files*Added\
69+
\n }\n ````\n\n\n\n## Supporting reading client certificates from PFX files*Added\
7070
\ in version 1.29.0*:\nFeed in a dictionary containing the path to a PFX file:\n\
7171
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
7272
: [], \"backrefs\": [], \"xml:space\": \"preserve\", \"language\": \"default\"\
@@ -267,25 +267,30 @@ constructor:
267267
\ in some situations.\n\nThis `http_cache` parameter accepts any dict-like object.\n\
268268
If not provided, MSAL will use an in-memory dict.\n\nIf your app is a command-line\
269269
\ app (CLI),\nyou would want to persist your http_cache across different CLI\
270-
\ runs.\nThe following recipe shows a way to do so:\n\n<!-- literal_block {\"\
271-
ids\": [], \"classes\": [], \"names\": [], \"dupnames\": [], \"backrefs\": [],\
272-
\ \"xml:space\": \"preserve\", \"language\": \"default\", \"force\": false,\
273-
\ \"linenos\": false} -->\n\n````default\n\n # Just add the following lines\
274-
\ at the beginning of your CLI script\n import sys, atexit, pickle\n http_cache_filename\
275-
\ = sys.argv[0] + \".http_cache\"\n try:\n with open(http_cache_filename,\
276-
\ \"rb\") as f:\n persisted_http_cache = pickle.load(f) # Take a\
277-
\ snapshot\n except (\n FileNotFoundError, # Or IOError in Python\
278-
\ 2\n pickle.UnpicklingError, # A corrupted http cache file\n \
279-
\ ):\n persisted_http_cache = {} # Recover by starting afresh\n\
280-
\ atexit.register(lambda: pickle.dump(\n # When exit, flush it back\
281-
\ to the file.\n # It may occasionally overwrite another process's concurrent\
282-
\ write,\n # but that is fine. Subsequent runs will reach eventual consistency.\n\
283-
\ persisted_http_cache, open(http_cache_file, \"wb\")))\n\n # And then\
284-
\ you can implement your app as you normally would\n app = msal.PublicClientApplication(\n\
285-
\ \"your_client_id\",\n ...,\n http_cache=persisted_http_cache,\
286-
\ # Utilize persisted_http_cache\n ...,\n #token_cache=..., #\
287-
\ You may combine the old token_cache trick\n # Please refer to token_cache\
288-
\ recipe at\n # https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache\n\
270+
\ runs.\nThe persisted file's format may change due to, but not limited to,\n\
271+
[unstable protocol](https://docs.python.org/3/library/pickle.html#data-stream-format),\n\
272+
so your implementation shall tolerate unexpected loading errors.\nThe following\
273+
\ recipe shows a way to do so:\n\n<!-- literal_block {\"ids\": [], \"classes\"\
274+
: [], \"names\": [], \"dupnames\": [], \"backrefs\": [], \"xml:space\": \"preserve\"\
275+
, \"language\": \"default\", \"force\": false, \"linenos\": false} -->\n\n````default\n\
276+
\n # Just add the following lines at the beginning of your CLI script\n \
277+
\ import sys, atexit, pickle, logging\n http_cache_filename = sys.argv[0]\
278+
\ + \".http_cache\"\n try:\n with open(http_cache_filename, \"rb\")\
279+
\ as f:\n persisted_http_cache = pickle.load(f) # Take a snapshot\n\
280+
\ except (\n FileNotFoundError, # Or IOError in Python 2\n \
281+
\ pickle.UnpicklingError, # A corrupted http cache file\n AttributeError,\
282+
\ # Cache created by a different version of MSAL\n ):\n persisted_http_cache\
283+
\ = {} # Recover by starting afresh\n except: # Unexpected exceptions\n\
284+
\ logging.exception(\"You may want to debug this\")\n persisted_http_cache\
285+
\ = {} # Recover by starting afresh\n atexit.register(lambda: pickle.dump(\n\
286+
\ # When exit, flush it back to the file.\n # It may occasionally\
287+
\ overwrite another process's concurrent write,\n # but that is fine.\
288+
\ Subsequent runs will reach eventual consistency.\n persisted_http_cache,\
289+
\ open(http_cache_file, \"wb\")))\n\n # And then you can implement your app\
290+
\ as you normally would\n app = msal.PublicClientApplication(\n \"your_client_id\"\
291+
,\n ...,\n http_cache=persisted_http_cache, # Utilize persisted_http_cache\n\
292+
\ ...,\n #token_cache=..., # You may combine the old token_cache\
293+
\ trick\n # Please refer to token_cache recipe at\n # https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache\n\
289294
\ )\n app.acquire_token_interactive([\"your\", \"scope\"], ...)\n \
290295
\ ````\n\nContent inside `http_cache` are cheap to obtain.\nThere is no need\
291296
\ to share them among different apps.\n\nContent inside `http_cache` will contain\

python/docs-ref-autogen/msal/msal.application.ConfidentialClientApplication.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ constructor:
6666
: [], \"backrefs\": [], \"xml:space\": \"preserve\", \"language\": \"default\"\
6767
, \"force\": false, \"linenos\": false} -->\n\n````default\n\n {\n \"\
6868
client_assertion\": \"...a JWT with claims aud, exp, iss, jti, nbf, and sub...\"\
69-
\n }\n ````\n\n\n\n## Supporting reading client cerficates from PFX files*Added\
69+
\n }\n ````\n\n\n\n## Supporting reading client certificates from PFX files*Added\
7070
\ in version 1.29.0*:\nFeed in a dictionary containing the path to a PFX file:\n\
7171
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
7272
: [], \"backrefs\": [], \"xml:space\": \"preserve\", \"language\": \"default\"\
@@ -267,25 +267,30 @@ constructor:
267267
\ in some situations.\n\nThis `http_cache` parameter accepts any dict-like object.\n\
268268
If not provided, MSAL will use an in-memory dict.\n\nIf your app is a command-line\
269269
\ app (CLI),\nyou would want to persist your http_cache across different CLI\
270-
\ runs.\nThe following recipe shows a way to do so:\n\n<!-- literal_block {\"\
271-
ids\": [], \"classes\": [], \"names\": [], \"dupnames\": [], \"backrefs\": [],\
272-
\ \"xml:space\": \"preserve\", \"language\": \"default\", \"force\": false,\
273-
\ \"linenos\": false} -->\n\n````default\n\n # Just add the following lines\
274-
\ at the beginning of your CLI script\n import sys, atexit, pickle\n http_cache_filename\
275-
\ = sys.argv[0] + \".http_cache\"\n try:\n with open(http_cache_filename,\
276-
\ \"rb\") as f:\n persisted_http_cache = pickle.load(f) # Take a\
277-
\ snapshot\n except (\n FileNotFoundError, # Or IOError in Python\
278-
\ 2\n pickle.UnpicklingError, # A corrupted http cache file\n \
279-
\ ):\n persisted_http_cache = {} # Recover by starting afresh\n\
280-
\ atexit.register(lambda: pickle.dump(\n # When exit, flush it back\
281-
\ to the file.\n # It may occasionally overwrite another process's concurrent\
282-
\ write,\n # but that is fine. Subsequent runs will reach eventual consistency.\n\
283-
\ persisted_http_cache, open(http_cache_file, \"wb\")))\n\n # And then\
284-
\ you can implement your app as you normally would\n app = msal.PublicClientApplication(\n\
285-
\ \"your_client_id\",\n ...,\n http_cache=persisted_http_cache,\
286-
\ # Utilize persisted_http_cache\n ...,\n #token_cache=..., #\
287-
\ You may combine the old token_cache trick\n # Please refer to token_cache\
288-
\ recipe at\n # https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache\n\
270+
\ runs.\nThe persisted file's format may change due to, but not limited to,\n\
271+
[unstable protocol](https://docs.python.org/3/library/pickle.html#data-stream-format),\n\
272+
so your implementation shall tolerate unexpected loading errors.\nThe following\
273+
\ recipe shows a way to do so:\n\n<!-- literal_block {\"ids\": [], \"classes\"\
274+
: [], \"names\": [], \"dupnames\": [], \"backrefs\": [], \"xml:space\": \"preserve\"\
275+
, \"language\": \"default\", \"force\": false, \"linenos\": false} -->\n\n````default\n\
276+
\n # Just add the following lines at the beginning of your CLI script\n \
277+
\ import sys, atexit, pickle, logging\n http_cache_filename = sys.argv[0]\
278+
\ + \".http_cache\"\n try:\n with open(http_cache_filename, \"rb\")\
279+
\ as f:\n persisted_http_cache = pickle.load(f) # Take a snapshot\n\
280+
\ except (\n FileNotFoundError, # Or IOError in Python 2\n \
281+
\ pickle.UnpicklingError, # A corrupted http cache file\n AttributeError,\
282+
\ # Cache created by a different version of MSAL\n ):\n persisted_http_cache\
283+
\ = {} # Recover by starting afresh\n except: # Unexpected exceptions\n\
284+
\ logging.exception(\"You may want to debug this\")\n persisted_http_cache\
285+
\ = {} # Recover by starting afresh\n atexit.register(lambda: pickle.dump(\n\
286+
\ # When exit, flush it back to the file.\n # It may occasionally\
287+
\ overwrite another process's concurrent write,\n # but that is fine.\
288+
\ Subsequent runs will reach eventual consistency.\n persisted_http_cache,\
289+
\ open(http_cache_file, \"wb\")))\n\n # And then you can implement your app\
290+
\ as you normally would\n app = msal.PublicClientApplication(\n \"your_client_id\"\
291+
,\n ...,\n http_cache=persisted_http_cache, # Utilize persisted_http_cache\n\
292+
\ ...,\n #token_cache=..., # You may combine the old token_cache\
293+
\ trick\n # Please refer to token_cache recipe at\n # https://msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache\n\
289294
\ )\n app.acquire_token_interactive([\"your\", \"scope\"], ...)\n \
290295
\ ````\n\nContent inside `http_cache` are cheap to obtain.\nThere is no need\
291296
\ to share them among different apps.\n\nContent inside `http_cache` will contain\

python/docs-ref-autogen/msal/msal.application.PublicClientApplication.yml

Lines changed: 61 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,38 @@ name: PublicClientApplication
44
fullName: msal.application.PublicClientApplication
55
module: msal.application
66
summary: "Same as <xref:ClientApplication.__init__>,\nexcept that `client_credential`\
7-
\ parameter shall remain `None`.\n\n> [!NOTE]\n> You may set enable_broker_on_windows\
8-
\ and/or enable_broker_on_mac to True.\n>\n> \n>\n> What is a broker, and why use\
9-
\ it?\n>\n> \n>\n> A broker is a component installed on your device.\n>\n> Broker\
10-
\ implicitly gives your device an identity. By using a broker,\n>\n> your device\
11-
\ becomes a factor that can satisfy MFA (Multi-factor authentication).\n>\n> This\
12-
\ factor would become mandatory\n>\n> if a tenant's admin enables a corresponding\
13-
\ Conditional Access (CA) policy.\n>\n> The broker's presence allows Microsoft identity\
14-
\ platform\n>\n> to have higher confidence that the tokens are being issued to your\
15-
\ device,\n>\n> and that is more secure.\n>\n> \n>\n> An additional benefit of broker\
16-
\ is,\n>\n> it runs as a long-lived process with your device's OS,\n>\n> and maintains\
7+
\ parameter shall remain `None`.\n\n> [!NOTE]\n> What is a broker, and why use it?\n\
8+
>\n> \n>\n> A broker is a component installed on your device.\n>\n> Broker implicitly\
9+
\ gives your device an identity. By using a broker,\n>\n> your device becomes a\
10+
\ factor that can satisfy MFA (Multi-factor authentication).\n>\n> This factor would\
11+
\ become mandatory\n>\n> if a tenant's admin enables a corresponding Conditional\
12+
\ Access (CA) policy.\n>\n> The broker's presence allows Microsoft identity platform\n\
13+
>\n> to have higher confidence that the tokens are being issued to your device,\n\
14+
>\n> and that is more secure.\n>\n> \n>\n> An additional benefit of broker is,\n\
15+
>\n> it runs as a long-lived process with your device's OS,\n>\n> and maintains\
1716
\ its own cache,\n>\n> so that your broker-enabled apps (even a CLI)\n>\n> could\
1817
\ automatically SSO from a previously established signed-in session.\n>\n> \n>\n\
19-
> You shall only enable broker when your app:\n>\n> \n>\n> is running on supported\
20-
\ platforms,\n>\n> and already registered their corresponding redirect_uri\n>\n\
21-
> \n>\n> ms-appx-web://Microsoft.AAD.BrokerPlugin/your_client_id\n>\n> if your app\
22-
\ is expected to run on Windows 10+\n>\n> \n>\n> msauth.com.msauth.unsignedapp://auth\n\
23-
>\n> if your app is expected to run on Mac\n>\n> \n>\n> installed broker dependency,\n\
24-
>\n> e.g. pip install msal[broker]>=1.31,<2.\n>\n> \n>\n> tested with acquire_token_interactive()\
25-
\ and acquire_token_silent().\n>\n> \n>\n> The fallback behaviors of MSAL Python's\
26-
\ broker support\n>\n> \n>\n> MSAL will either error out, or silently fallback to\
27-
\ non-broker flows.\n>\n> \n>\n> MSAL will ignore the enable_broker_... and bypass\
28-
\ broker\n>\n> on those auth flows that are known to be NOT supported by broker.\n\
29-
>\n> This includes ADFS, B2C, etc..\n>\n> For other \"could-use-broker\" scenarios,\
30-
\ please see below.\n>\n> \n>\n> MSAL errors out when app developer opted-in to\
31-
\ use broker\n>\n> but a direct dependency \"mid-tier\" package is not installed.\n\
32-
>\n> Error message guides app developer to declare the correct dependency\n>\n>\
33-
\ msal[broker].\n>\n> We error out here because the error is actionable to app developers.\n\
34-
>\n> \n>\n> MSAL silently \"deactivates\" the broker and fallback to non-broker,\n\
18+
> How to opt in to use broker?\n>\n> \n>\n> You can set any combination of the following\
19+
\ opt-in parameters to true:\n>\n> \n>\n> \n>\n> \n>\n> \n>\n> \n>\n> \n>\n> \n\
20+
>\n> Opt-in flag\n>\n> \n>\n> If app will run on\n>\n> \n>\n> App has registered\
21+
\ this as a Desktop platform redirect URI in Azure Portal\n>\n> \n>\n> enable_broker_on_windows\n\
22+
>\n> \n>\n> Windows 10+\n>\n> \n>\n> ms-appx-web://Microsoft.AAD.BrokerPlugin/your_client_id\n\
23+
>\n> \n>\n> enable_broker_on_wsl\n>\n> \n>\n> WSL\n>\n> \n>\n> ms-appx-web://Microsoft.AAD.BrokerPlugin/your_client_id\n\
24+
>\n> \n>\n> enable_broker_on_mac\n>\n> \n>\n> Mac with Company Portal installed\n\
25+
>\n> \n>\n> msauth.com.msauth.unsignedapp://auth\n>\n> \n>\n> enable_broker_on_linux\n\
26+
>\n> \n>\n> Linux with Intune installed\n>\n> \n>\n> https://login.microsoftonline.com/common/oauth2/nativeclient\
27+
\ (MUST be enabled)\n>\n> \n>\n> Install broker dependency,\n>\n> e.g. pip install\
28+
\ msal[broker]>=1.33,<2.\n>\n> \n>\n> Test with acquire_token_interactive() and\
29+
\ acquire_token_silent().\n>\n> \n>\n> The fallback behaviors of MSAL Python's broker\
30+
\ support\n>\n> \n>\n> MSAL will either error out, or silently fallback to non-broker\
31+
\ flows.\n>\n> \n>\n> MSAL will ignore the enable_broker_... and bypass broker\n\
32+
>\n> on those auth flows that are known to be NOT supported by broker.\n>\n> This\
33+
\ includes ADFS, B2C, etc..\n>\n> For other \"could-use-broker\" scenarios, please\
34+
\ see below.\n>\n> \n>\n> MSAL errors out when app developer opted-in to use broker\n\
35+
>\n> but a direct dependency \"mid-tier\" package is not installed.\n>\n> Error\
36+
\ message guides app developer to declare the correct dependency\n>\n> msal[broker].\n\
37+
>\n> We error out here because the error is actionable to app developers.\n>\n>\
38+
\ \n>\n> MSAL silently \"deactivates\" the broker and fallback to non-broker,\n\
3539
>\n> when opted-in, dependency installed yet failed to initialize.\n>\n> We anticipate\
3640
\ this would happen on a device whose OS is too old\n>\n> or the underlying broker\
3741
\ component is somehow unavailable.\n>\n> There is not much an app developer or\
@@ -41,7 +45,8 @@ summary: "Same as <xref:ClientApplication.__init__>,\nexcept that `client_creden
4145
\ failed.\n>"
4246
constructor:
4347
syntax: PublicClientApplication(client_id, client_credential=None, *, enable_broker_on_windows=None,
44-
enable_broker_on_mac=None, **kwargs)
48+
enable_broker_on_mac=None, enable_broker_on_linux=None, enable_broker_on_wsl=None,
49+
**kwargs)
4550
parameters:
4651
- name: enable_broker_on_windows
4752
description: 'This setting is only effective if your app is running on Windows
@@ -64,6 +69,27 @@ constructor:
6469
isRequired: true
6570
types:
6671
- <xref:boolean>
72+
- name: enable_broker_on_linux
73+
description: 'This setting is only effective if your app is running on Linux,
74+
including WSL.
75+
76+
This parameter defaults to None, which means MSAL will not utilize a broker.
77+
78+
79+
New in MSAL Python 1.33.0.'
80+
isRequired: true
81+
types:
82+
- <xref:boolean>
83+
- name: enable_broker_on_wsl
84+
description: 'This setting is only effective if your app is running on WSL.
85+
86+
This parameter defaults to None, which means MSAL will not utilize a broker.
87+
88+
89+
New in MSAL Python 1.33.0.'
90+
isRequired: true
91+
types:
92+
- <xref:boolean>
6793
- name: client_id
6894
isRequired: true
6995
- name: client_credential
@@ -73,6 +99,10 @@ constructor:
7399
defaultValue: None
74100
- name: enable_broker_on_mac
75101
defaultValue: None
102+
- name: enable_broker_on_linux
103+
defaultValue: None
104+
- name: enable_broker_on_wsl
105+
defaultValue: None
76106
methods:
77107
- uid: msal.application.PublicClientApplication.acquire_token_by_device_flow
78108
name: acquire_token_by_device_flow
@@ -268,13 +298,16 @@ methods:
268298
summary: 'Initiate a Device Flow instance,
269299
270300
which will be used in <xref:msal.application.PublicClientApplication.acquire_token_by_device_flow>.'
271-
signature: initiate_device_flow(scopes=None, **kwargs)
301+
signature: initiate_device_flow(scopes=None, *, claims_challenge=None, **kwargs)
272302
parameters:
273303
- name: scopes
274304
description: Scopes requested to access a protected API (a resource).
275305
defaultValue: None
276306
types:
277307
- <xref:list>[<xref:str>]
308+
keywordOnlyParameters:
309+
- name: claims_challenge
310+
defaultValue: None
278311
return:
279312
description: "A dict representing a newly created Device Flow object.\n\n* A successful\
280313
\ response would contain \"user_code\" key, among others \n\n* an error response\

0 commit comments

Comments
 (0)