Skip to content

Commit 26a3cec

Browse files
committed
Merging changes synced from https://github.com/MicrosoftDocs/azure-docs-pr (branch live)
2 parents f71b82c + 0486aba commit 26a3cec

File tree

114 files changed

+2447
-1097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2447
-1097
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42036,6 +42036,11 @@
4203642036
"redirect_url": "/azure/mysql/reference-stored-procedures",
4203742037
"redirect_document_id": false
4203842038
},
42039+
{
42040+
"source_path": "articles/iot-accelerators/iot-accelerators-architecture-overview.md",
42041+
"redirect_url": "https://docs.microsoft.com/azure/architecture/reference-architectures/iot/",
42042+
"redirect_document_id": false
42043+
},
4203942044
{
4204042045
"source_path": "articles/mariadb/reference-data-in-stored-procedures.md",
4204142046
"redirect_url": "/azure/mariadb/reference-stored-procedures",

articles/active-directory/develop/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@
344344
href: v2-permissions-and-consent.md
345345
- name: Consent framework
346346
href: consent-framework.md
347+
- name: Admin consent
348+
href: v2-admin-consent.md
347349
- name: Application consent experiences
348350
href: application-consent-experience.md
349351
- name: National Clouds
1.25 KB
Loading
1.23 KB
Loading
992 Bytes
Loading

articles/active-directory/develop/quickstart-v2-ios.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,9 @@ Your app must also have the following in your `AppDelegate`. This lets MSAL SDK
193193
194194
```swift
195195
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
196-
guard let sourceApplication = options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String else {
197-
return false
198-
}
199-
200-
return MSALPublicClientApplication.handleMSALResponse(url, sourceApplication: sourceApplication)
201-
}
196+
197+
return MSALPublicClientApplication.handleMSALResponse(url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String)
198+
}
202199
203200
```
204201

articles/active-directory/develop/quickstart-v2-python-webapp.md

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.devlang: na
1313
ms.topic: quickstart
1414
ms.tgt_pltfrm: na
1515
ms.workload: identity
16-
ms.date: 09/11/2019
16+
ms.date: 09/25/2019
1717
ms.author: abpati
1818
ms.custom: aaddev
1919
---
@@ -98,49 +98,35 @@ To run this sample, you will need:
9898
1. Open the **app_config.py** file, which can be found in the root folder and replace with the following code snippet:
9999

100100
```python
101-
AUTHORITY = "https://login.microsoftonline.com/Enter_the_Tenant_Name_Here"
102-
CLIENT_ID = "Enter_the_Application_Id_here"
103101
CLIENT_SECRET = "Enter_the_Client_Secret_Here"
104-
SCOPE = ["https://graph.microsoft.com/User.Read"]
105-
REDIRECT_URI = "http://localhost:5000/getAToken"
102+
CLIENT_ID = "Enter_the_Application_Id_here"
106103
```
107104

108105
> [!div renderon="docs"]
109106
> Where:
110107
>
111108
> - `Enter_the_Application_Id_here` - is the Application Id for the application you registered.
112-
> - `Enter_the_Tenant_Info_Here` - is one of the options below:
113-
> - If your application supports **My organization only**, replace this value with the **Tenant Id** or **Tenant name** (for example, contoso.onmicrosoft.com)
114-
> - If your application supports **Accounts in any organizational directory**, replace this value with `organizations`
115-
> - If your application supports **All Microsoft account users**, replace this value with `common`
116109
> - `Enter_the_Client_Secret_Here` - is the **Client Secret** you created in **Certificates & Secrets** for the application you registered.
117110
118111
#### Step 4: Run the code sample
119112

120-
- You will need to install MSAL Python library, Flask framework, Flask-Sessions for server-side session management and requests using pip as follows:
113+
1. You will need to install MSAL Python library, Flask framework, Flask-Sessions for server-side session management and requests using pip as follows:
121114

122-
```Shell
123-
pip install msal
124-
pip install flask
125-
pip install Flask-Session
126-
pip install requests
127-
```
115+
```Shell
116+
pip install -r requirements.txt
117+
```
128118

129-
- If the environment variable for Flask is already set:
130-
Run app.py from shell or command line:
119+
2. Run app.py from shell or command line:
131120

132-
```Shell
133-
python app.py
134-
```
121+
```Shell
122+
python app.py
123+
```
135124

136-
- If the environment variable for Flask is not set:
125+
## Next steps
137126

138-
1. Type the following commands on shell or command line by navigating to the project directory:
127+
Learn more about web apps that sign in users, and then that calls web APIs:
139128

140-
```Shell
141-
export FLASK_APP=app.py
142-
export FLASK_DEBUG=1
143-
flask run
144-
```
129+
> [!div class="nextstepaction"]
130+
> [Scenario: Web apps that sign in users](scenario-web-app-sign-user-overview.md)
145131
146132
[!INCLUDE [Help and support](../../../includes/active-directory-develop-help-support-include.md)]

articles/active-directory/develop/scenario-web-app-call-api-app-configuration.md

Lines changed: 535 additions & 136 deletions
Large diffs are not rendered by default.

articles/active-directory/develop/scenario-web-app-sign-user-app-configuration.md

Lines changed: 59 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,36 @@ The libraries used to protect a Web App (and a Web API) are:
3131
| Platform | Library | Description |
3232
|----------|---------|-------------|
3333
| ![.NET](media/sample-v2-code/logo_net.png) | [Identity model extensions for .NET](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/wiki) | Used directly by ASP.NET and ASP.NET Core, Microsoft Identity Extensions for .NET proposes a set of DLLs running both on .NET Framework and .NET Core. From an ASP.NET/ASP.NET Core Web app, you can control token validation using the **TokenValidationParameters** class (in particular in some ISV scenarios) |
34-
| ![Java](media/sample-v2-code/logo_java.png) | [msal4j](https://github.com/AzureAD/microsoft-authentication-library-for-java/wiki) | MSAL for Java - currently in public preview |
35-
| ![Python](media/sample-v2-code/logo_python.png) | [MSAL Python](https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki) | MSAL for Python - currently in public preview |
34+
| ![Java](media/sample-v2-code/small_logo_java.png) | [msal4j](https://github.com/AzureAD/microsoft-authentication-library-for-java/wiki) | MSAL for Java - currently in public preview |
35+
| ![Python](media/sample-v2-code/small_logo_python.png) | [MSAL Python](https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki) | MSAL for Python - currently in public preview |
3636

37-
Code snippets in this article and the following are extracted from:
37+
Select the tab corresponding to the platform you're interested in:
3838

39-
- the [ASP.NET Core Web app incremental tutorial, chapter 1](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/master/1-WebApp-OIDC/1-1-MyOrg).
40-
- the [ASP.NET Web app sample](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect)
41-
- the [Java web application calling Microsoft graph](https://github.com/Azure-Samples/ms-identity-java-webapp) msal4j web app sample
42-
- the [Python web application calling Microsoft graph](https://github.com/Azure-Samples/ms-identity-python-webapp) MSAL.Python web app sample
39+
# [ASP.NET Core](#tab/aspnetcore)
40+
41+
Code snippets in this article and the following are extracted from the [ASP.NET Core Web app incremental tutorial, chapter 1](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/master/1-WebApp-OIDC/1-1-MyOrg).
42+
43+
You might want to refer to this tutorial for full implementation details.
44+
45+
# [ASP.NET](#tab/aspnet)
46+
47+
Code snippets in this article and the following are extracted from the [ASP.NET Web app sample](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect)
48+
49+
You might want to refer to this sample for full implementation details.
50+
51+
# [Java](#tab/java)
52+
53+
Code snippets in this article and the following are extracted from the [Java web application calling Microsoft graph](https://github.com/Azure-Samples/ms-identity-java-webapp) msal4j web app sample
54+
55+
You might want to refer to this sample for full implementation details.
56+
57+
# [Python](#tab/python)
4358

44-
You might want to refer to these tutorials and sample for full implementation details.
59+
Code snippets in this article and the following are extracted from the [Python web application calling Microsoft graph](https://github.com/Azure-Samples/ms-identity-python-webapp) MSAL.Python web app sample
60+
61+
You might want to refer to this sample for full implementation details.
62+
63+
---
4564

4665
## Configuration files
4766

@@ -55,7 +74,7 @@ Sometimes, applications can be parametrized by the `authority`, which is the con
5574

5675
# [ASP.NET Core](#tab/aspnetcore)
5776

58-
In ASP.NET Core, these settings are located in the `appsettings.json` file, in the "AzureAD" section.
77+
In ASP.NET Core, these settings are located in the [appsettings.json](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/bc564d68179c36546770bf4d6264ce72009bc65a/1-WebApp-OIDC/1-1-MyOrg/appsettings.json#L2-L8) file, in the "AzureAD" section.
5978

6079
```Json
6180
{
@@ -82,7 +101,7 @@ In ASP.NET Core, these settings are located in the `appsettings.json` file, in t
82101
}
83102
```
84103

85-
In ASP.NET Core, there's another file (`properties\launchSettings.json`) that contains the URL (`applicationUrl`) and the SSL Port (`sslPort`) for your application and various profiles.
104+
In ASP.NET Core, there's another file [properties\launchSettings.json](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/bc564d68179c36546770bf4d6264ce72009bc65a/1-WebApp-OIDC/1-1-MyOrg/Properties/launchSettings.json#L6-L7) that contains the URL (`applicationUrl`) and the SSL Port (`sslPort`) for your application and various profiles.
86105

87106
```Json
88107
{
@@ -120,7 +139,7 @@ In the same way, the sign-out URI would be set to `https://localhost:44321/signo
120139

121140
# [ASP.NET](#tab/aspnet)
122141

123-
In ASP.NET, the application is configured through the `Web.Config` file
142+
In ASP.NET, the application is configured through the [Web.Config](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect/blob/a2da310539aa613b77da1f9e1c17585311ab22b7/WebApp/Web.config#L12-L15) file lines 12-15
124143

125144
```XML
126145
<?xml version="1.0" encoding="utf-8"?>
@@ -146,7 +165,7 @@ In the Azure portal, the reply URIs that you need to register in the **Authentic
146165

147166
# [Java](#tab/java)
148167

149-
In Java, the configuration is located in the `application.properties` file located under `src/main/resources`
168+
In Java, the configuration is located in the [application.properties](https://github.com/Azure-Samples/ms-identity-java-webapp/blob/d55ee4ac0ce2c43378f2c99fd6e6856d41bdf144/src/main/resources/application.properties) file located under `src/main/resources`
150169

151170
```Java
152171
aad.clientId=Enter_the_Application_Id_here
@@ -160,16 +179,29 @@ In the Azure portal, the reply URIs that you need to register in the **Authentic
160179

161180
# [Python](#tab/python)
162181

163-
Here is the Python configuration file in [app_config.py](https://github.com/Azure-Samples/ms-identity-python-webapp/blob/web_app_sample/app_config.py)
182+
Here is the Python configuration file in [app_config.py](https://github.com/Azure-Samples/ms-identity-python-webapp/blob/0.1.0/app_config.py)
164183

165184
```Python
166-
AUTHORITY = "https://login.microsoftonline.com/Enter_the_Tenant_Name_Here"
167-
CLIENT_ID = "Enter_the_Application_Id_here"
168185
CLIENT_SECRET = "Enter_the_Client_Secret_Here"
169-
SCOPE = ["https://graph.microsoft.com/User.Read"]
170-
REDIRECT_URI = "http://localhost:5000/getAToken"
186+
AUTHORITY = "https://login.microsoftonline.com/common""
187+
CLIENT_ID = "Enter_the_Application_Id_here"
188+
ENDPOINT = 'https://graph.microsoft.com/v1.0/users'
189+
SCOPE = ["User.ReadBasic.All"]
190+
SESSION_TYPE = "filesystem" # So token cache will be stored in server-side session
171191
```
172192

193+
> [!NOTE]
194+
> This quickstart proposes to store the client secret in the configuration file for simplicity.
195+
> In your production app, you'd want to use other ways to store your secret,
196+
> such as KeyVault, or an environment variable as described in Flask's documentation:
197+
> https://flask.palletsprojects.com/en/1.1.x/config/#configuring-from-environment-variables
198+
>
199+
> ```python
200+
> CLIENT_SECRET = os.getenv("CLIENT_SECRET")
201+
> if not CLIENT_SECRET:
202+
> raise ValueError("Need to define CLIENT_SECRET environment variable")
203+
> ```
204+
173205
---
174206
175207
## Initialization code
@@ -281,11 +313,11 @@ public static IServiceCollection AddMicrosoftIdentityPlatformAuthentication(
281313
...
282314
```
283315
284-
The `AadIssuerValidator` class enables that the issuer of the token is validated in many cases (v1.0 or v2.0 token, single-tenant, or multi-tenant application or application that signs in users with their personal Microsoft accounts, in the Azure public cloud or national clouds). It's available from [Microsoft.Identity.Web/Resource/AadIssuerValidator.cs](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/master/Microsoft.Identity.Web/Resource/AadIssuerValidator.cs)
316+
The `AadIssuerValidator` class enables that the issuer of the token is validated in many cases (v1.0 or v2.0 token, single-tenant, or multi-tenant application or application that signs in users with their personal Microsoft accounts, in the Azure public cloud, or national clouds). It's available from [Microsoft.Identity.Web/Resource/AadIssuerValidator.cs](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/master/Microsoft.Identity.Web/Resource/AadIssuerValidator.cs)
285317
286318
# [ASP.NET](#tab/aspnet)
287319
288-
The code related to authentication in ASP.NET Web app / Web APIs is located in the `App_Start/Startup.Auth.cs` file.
320+
The code related to authentication in ASP.NET Web app / Web APIs is located in the [App_Start/Startup.Auth.cs](https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect/blob/a2da310539aa613b77da1f9e1c17585311ab22b7/WebApp/App_Start/Startup.Auth.cs#L17-L61) file.
289321
290322
```CSharp
291323
public void ConfigureAuth(IAppBuilder app)
@@ -311,7 +343,7 @@ The code related to authentication in ASP.NET Web app / Web APIs is located in t
311343
312344
# [Java](#tab/java)
313345
314-
The Java sample uses the Spring framework. The application is protected because you implement a `Filter`, which gets each HTTP response. In the Java Web app quickstart, this is `AuthFilter` in `src/main/java/com/microsoft/azure/msalwebsample/AuthFilter.java`. The filter process the OAuth 2.0 authorization code flow and therefore:
346+
The Java sample uses the Spring framework. The application is protected because you implement a `Filter`, which intercepts each HTTP response. In the Java Web app quickstart, this filter is `AuthFilter` in `src/main/java/com/microsoft/azure/msalwebsample/AuthFilter.java`. The filter process the OAuth 2.0 authorization code flow and therefore:
315347
316348
- verifies if the user is authenticated (`isAuthenticated()` method)
317349
- if the user isn't authenticated, it computes the url of the Azure AD authorize endpoints, and redirects the browser to this URI
@@ -323,45 +355,24 @@ For details see the `doFilter()` method in [AuthFilter.java](https://github.com/
323355
> [!NOTE]
324356
> The code of the `doFilter()` is written in a slightly different order, but the flow is the one described.
325357
326-
See [Microsoft identity platform and OAuth 2.0 authorization code flow](v2-oauth2-auth-code-flow.md) for details about the authorization code flow triggered by this method
358+
See [Microsoft identity platform and OAuth 2.0 authorization code flow](v2-oauth2-auth-code-flow.md) for details about the authorization code flow, triggered by this method
327359
328360
# [Python](#tab/python)
329361
330-
The Python sample uses Flask. The initialization of flask, and MSAL.Python is done in [app.py#L1-L17](https://github.com/Azure-Samples/ms-identity-python-webapp/blob/e1199b4c3cdcb637cf0d8306832efbd85492e123/app.py#L1-L17)
362+
The Python sample uses Flask. The initialization of flask, and MSAL.Python is done in [app.py#L1-L28](https://github.com/Azure-Samples/ms-identity-python-webapp/blob/e03be352914bfbd58be0d4170eba1fb7a4951d84/app.py#L1-L28)
331363
332364
```Python
333365
import uuid
334-
import flask
335366
import requests
336-
from flask import Flask, render_template, session, request
337-
from flask_session import Session
367+
from flask import Flask, render_template, session, request, redirect, url_for
368+
from flask_session import Session # https://pythonhosted.org/Flask-Session
338369
import msal
339370
import app_config
340371
341-
sess = Session()
342-
app = Flask(__name__)
343-
app.config.from_object('config.Config')
344-
sess.init_app(app)
345-
cache = msal.SerializableTokenCache()
346-
application = msal.ConfidentialClientApplication(
347-
app_config.CLIENT_ID, authority=app_config.AUTHORITY,
348-
client_credential=app_config.CLIENT_SECRET,
349-
token_cache=cache)
350-
```
351-
352-
This is MSAL.Python that will take care of letting the user sign-in. See [app.py#L74-84](https://github.com/Azure-Samples/ms-identity-python-webapp/blob/e1199b4c3cdcb637cf0d8306832efbd85492e123/app.py#L74-84)
353372
354-
```Python
355-
@app.route('/authenticate')
356-
def authenticate():
357-
# Call to the authorize endpoint
358-
auth_state = str(uuid.uuid4())
359-
session[(request.cookies.get("session")+'state')] = auth_state
360-
authorization_url = application.get_authorization_request_url(app_config.SCOPE, state=auth_state,
361-
redirect_uri=app_config.REDIRECT_URI)
362-
resp = flask.Response(status=307)
363-
resp.headers['location'] = authorization_url
364-
return resp
373+
app = Flask(__name__)
374+
app.config.from_object(app_config)
375+
Session(app)
365376
```
366377
367378
---

0 commit comments

Comments
 (0)