Skip to content

Commit fa1d752

Browse files
authored
Merge pull request #98668 from MicrosoftDocs/master
12/11 AM Publish
2 parents 137254d + 8ad340a commit fa1d752

File tree

91 files changed

+759
-351
lines changed

Some content is hidden

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

91 files changed

+759
-351
lines changed

articles/active-directory-b2c/b2clogin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ For migrating Azure API Management APIs protected by Azure AD B2C, see the [Migr
8989

9090
If you're using [MSAL.NET][msal-dotnet] v2 or earlier, set the **ValidateAuthority** property to `false` on client instantiation to allow redirects to *b2clogin.com*. This setting is not required for MSAL.NET v3 and above.
9191

92-
```CSharp
92+
```csharp
9393
ConfidentialClientApplication client = new ConfidentialClientApplication(...); // Can also be PublicClientApplication
9494
client.ValidateAuthority = false; // MSAL.NET v2 and earlier **ONLY**
9595
```

articles/active-directory/develop/howto-restrict-your-app-to-a-set-of-users.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The option to restrict an app to a specific set of users or security groups in a
4242

4343
There are two ways to create an application with enabled user assignment. One requires the **Global Administrator** role, the second does not.
4444

45-
### Enterprise applications (requires the Global Adminstrator role)
45+
### Enterprise applications (requires the Global Administrator role)
4646

4747
1. Go to the [**Azure portal**](https://portal.azure.com/) and sign in as a **Global Administrator**.
4848
1. On the top bar, select the signed-in account.

articles/active-directory/develop/msal-net-client-assertions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ MSAL.NET has four methods to provide either credentials or assertions to the con
3939

4040
A signed client assertion takes the form of a signed JWT with the payload containing the required authentication claims mandated by Azure AD, Base64 encoded. To use it:
4141

42-
```CSharp
42+
```csharp
4343
string signedClientAssertion = ComputeAssertion();
4444
app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
4545
.WithClientAssertion(signedClientAssertion)
@@ -59,7 +59,7 @@ sub | {ClientID} | The "sub" (subject) claim identifies the subject of the JWT.
5959

6060
Here is an example of how to craft these claims:
6161

62-
```CSharp
62+
```csharp
6363
private static IDictionary<string, string> GetClaims()
6464
{
6565
//aud = https://login.microsoftonline.com/ + Tenant ID + /v2.0
@@ -85,7 +85,7 @@ private static IDictionary<string, string> GetClaims()
8585

8686
Here is how to craft a signed client assertion:
8787

88-
```CSharp
88+
```csharp
8989
string Encode(byte[] arg)
9090
{
9191
char Base64PadCharacter = '=';
@@ -135,7 +135,7 @@ string GetSignedClientAssertion()
135135

136136
You also have the option of using [Microsoft.IdentityModel.JsonWebTokens](https://www.nuget.org/packages/Microsoft.IdentityModel.JsonWebTokens/) to create the assertion for you. The code will be a more elegant as shown in the example below:
137137

138-
```CSharp
138+
```csharp
139139
string GetSignedClientAssertion()
140140
{
141141
var cert = new X509Certificate2("Certificate.pfx", "Password", X509KeyStorageFlags.EphemeralKeySet);
@@ -168,7 +168,7 @@ You also have the option of using [Microsoft.IdentityModel.JsonWebTokens](https:
168168

169169
Once you have your signed client assertion, you can use it with the MSAL apis as shown below.
170170

171-
```CSharp
171+
```csharp
172172
string signedClientAssertion = GetSignedClientAssertion();
173173

174174
var confidentialApp = ConfidentialClientApplicationBuilder
@@ -181,7 +181,7 @@ Once you have your signed client assertion, you can use it with the MSAL apis as
181181

182182
`WithClientClaims(X509Certificate2 certificate, IDictionary<string, string> claimsToSign, bool mergeWithDefaultClaims = true)` by default will produce a signed assertion containing the claims expected by Azure AD plus additional client claims that you want to send. Here is a code snippet on how to do that.
183183

184-
```CSharp
184+
```csharp
185185
string ipAddress = "192.168.1.2";
186186
X509Certificate2 certificate = ReadCertificate(config.CertificateName);
187187
app = ConfidentialClientApplicationBuilder.Create(config.ClientId)

articles/active-directory/develop/msal-net-migration-ios-broker.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ In ADAL.NET, broker support was enabled on a per-authentication context basis. I
4949

5050
`useBroker` flag to true in the `PlatformParameters` constructor to call the broker:
5151

52-
```CSharp
52+
```csharp
5353
public PlatformParameters(
5454
UIViewController callerViewController,
5555
bool useBroker)
5656
```
5757
Also, in the platform-specific code, in this example, in the page renderer for iOS, set the
5858
`useBroker`
5959
flag to true:
60-
```CSharp
60+
```csharp
6161
page.BrokerParameters = new PlatformParameters(
6262
this,
6363
true,
6464
PromptBehavior.SelectAccount);
6565
```
6666

6767
Then, include the parameters in the acquire token call:
68-
```CSharp
68+
```csharp
6969
AuthenticationResult result =
7070
await
7171
AuthContext.AcquireTokenAsync(
@@ -82,15 +82,15 @@ In MSAL.NET, broker support is enabled on a per-PublicClientApplication basis. I
8282
`WithBroker()`
8383
parameter (set to true by default) in order to call the broker:
8484

85-
```CSharp
85+
```csharp
8686
var app = PublicClientApplicationBuilder
8787
.Create(ClientId)
8888
.WithBroker()
8989
.WithReplyUri(redirectUriOnIos)
9090
.Build();
9191
```
9292
In the acquire token call:
93-
```CSharp
93+
```csharp
9494
result = await app.AcquireTokenInteractive(scopes)
9595
.WithParentActivityOrWindow(App.RootViewController)
9696
.ExecuteAsync();
@@ -106,7 +106,7 @@ A UIViewController is passed into
106106

107107
`PlatformParameters` in the iOS-specific platform.
108108

109-
```CSharp
109+
```csharp
110110
page.BrokerParameters = new PlatformParameters(
111111
this,
112112
true,
@@ -125,16 +125,16 @@ This assignment ensures that there's a UIViewController with the call to the bro
125125
**For example:**
126126

127127
In `App.cs`:
128-
```CSharp
128+
```csharp
129129
public static object RootViewController { get; set; }
130130
```
131131
In `AppDelegate.cs`:
132-
```CSharp
132+
```csharp
133133
LoadApplication(new App());
134134
App.RootViewController = new UIViewController();
135135
```
136136
In the acquire token call:
137-
```CSharp
137+
```csharp
138138
result = await app.AcquireTokenInteractive(scopes)
139139
.WithParentActivityOrWindow(App.RootViewController)
140140
.ExecuteAsync();
@@ -168,7 +168,7 @@ as a prefix, followed by your
168168
For example:
169169
`$"msauth.(BundleId")`
170170

171-
```CSharp
171+
```csharp
172172
<key>CFBundleURLTypes</key>
173173
<array>
174174
<dict>
@@ -201,7 +201,7 @@ Uses
201201
`msauth`
202202

203203

204-
```CSharp
204+
```csharp
205205
<key>LSApplicationQueriesSchemes</key>
206206
<array>
207207
<string>msauth</string>
@@ -213,7 +213,7 @@ Uses
213213
`msauthv2`
214214

215215

216-
```CSharp
216+
```csharp
217217
<key>LSApplicationQueriesSchemes</key>
218218
<array>
219219
<string>msauthv2</string>

articles/active-directory/develop/msal-net-migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ MSAL.NET does not expose refresh tokens, for security reasons: MSAL handles refr
222222

223223
Fortunately, MSAL.NET now has an API that allows you to migrate your previous refresh tokens (acquired with ADAL) into the `IConfidentialClientApplication`:
224224

225-
```CSharp
225+
```csharp
226226
/// <summary>
227227
/// Acquires an access token from an existing refresh token and stores it and the refresh token into
228228
/// the application user token cache, where it will be available for further AcquireTokenSilent calls.

articles/active-directory/develop/msal-net-use-brokers-with-xamarin-apps.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Follow these steps to enable your Xamarin.iOS app to talk with the [Microsoft Au
3535
### Step 1: Enable broker support
3636
Broker support is enabled on a per-PublicClientApplication basis. It's disabled by default. Use the `WithBroker()` parameter (set to true by default) when you create the PublicClientApplication through the PublicClientApplicationBuilder.
3737

38-
```CSharp
38+
```csharp
3939
var app = PublicClientApplicationBuilder
4040
.Create(ClientId)
4141
.WithBroker()
@@ -46,7 +46,7 @@ var app = PublicClientApplicationBuilder
4646
### Step 2: Update AppDelegate to handle the callback
4747
When the Microsoft Authentication Library for .NET (MSAL.NET) calls the broker, the broker in turn calls back to your application through the `OpenUrl` method of the `AppDelegate` class. Because MSAL waits for the response from the broker, your application needs to cooperate to call MSAL.NET back. To enable this cooperation, update the `AppDelegate.cs` file to override the following method.
4848

49-
```CSharp
49+
```csharp
5050
public override bool OpenUrl(UIApplication app, NSUrl url,
5151
string sourceApplication,
5252
NSObject annotation)
@@ -79,16 +79,16 @@ To do this, you do two things.
7979
**For example:**
8080

8181
In `App.cs`:
82-
```CSharp
82+
```csharp
8383
public static object RootViewController { get; set; }
8484
```
8585
In `AppDelegate.cs`:
86-
```CSharp
86+
```csharp
8787
LoadApplication(new App());
8888
App.RootViewController = new UIViewController();
8989
```
9090
In the acquire token call:
91-
```CSharp
91+
```csharp
9292
result = await app.AcquireTokenInteractive(scopes)
9393
.WithParentActivityOrWindow(App.RootViewController)
9494
.ExecuteAsync();
@@ -138,11 +138,11 @@ Add `msauthv2` to the `LSApplicationQueriesSchemes` section of the `Info.plist`
138138

139139
### Step 6: Register your redirect URI in the application portal
140140
Using the broker adds an extra requirement on your redirect URI. The redirect URI _must_ have the following format:
141-
```CSharp
141+
```csharp
142142
$"msauth.{BundleId}://auth"
143143
```
144144
**For example:**
145-
```CSharp
145+
```csharp
146146
public static string redirectUriOnIos = "msauth.com.yourcompany.XForms://auth";
147147
```
148148
Notice that the redirect URI matches the `CFBundleURLSchemes` name you included in the `Info.plist` file.

articles/active-directory/develop/msal-net-xamarin-android-considerations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var authResult = AcquireTokenInteractive(scopes)
3232
```
3333
You can also set this at the PublicClientApplication level (in MSAL4.2+) via a callback.
3434

35-
```CSharp
35+
```csharp
3636
// Requires MSAL.NET 4.2 or above
3737
var pca = PublicClientApplicationBuilder
3838
.Create("<your-client-id-here>")
@@ -42,7 +42,7 @@ var pca = PublicClientApplicationBuilder
4242

4343
A recommendation is to use the CurrentActivityPlugin [here](https://github.com/jamesmontemagno/CurrentActivityPlugin). Then your PublicClientApplication builder code would look like this:
4444

45-
```CSharp
45+
```csharp
4646
// Requires MSAL.NET 4.2 or above
4747
var pca = PublicClientApplicationBuilder
4848
.Create("<your-client-id-here>")

articles/active-directory/develop/msal-net-xamarin-ios-considerations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ You might also see a break in ASP.NET Core OIDC authentication with iOS 12 Safar
3838

3939
First you need to override the `OpenUrl` method of the `FormsApplicationDelegate` derived class and call `AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs`.
4040

41-
```CSharp
41+
```csharp
4242
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
4343
{
4444
AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(url);

articles/active-directory/develop/scenario-daemon-acquire-token.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The scope to request for a client credential flow is the name of the resource fo
3030

3131
# [.NET](#tab/dotnet)
3232

33-
```CSharp
33+
```csharp
3434
ResourceId = "someAppIDURI";
3535
var scopes = new [] { ResourceId+"/.default"};
3636
```
@@ -67,7 +67,7 @@ To acquire a token for the app, you'll use `AcquireTokenForClient` or the equiva
6767

6868
# [.NET](#tab/dotnet)
6969

70-
```CSharp
70+
```csharp
7171
using Microsoft.Identity.Client;
7272

7373
// With client credentials flows the scopes is ALWAYS of the shape "resource/.default", as the

articles/active-directory/develop/scenario-daemon-app-configuration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Add the [Microsoft.IdentityClient](https://www.nuget.org/packages/Microsoft.Iden
133133
In MSAL.NET, the confidential client application is represented by the `IConfidentialClientApplication` interface.
134134
Use MSAL.NET namespace in the source code
135135

136-
```CSharp
136+
```csharp
137137
using Microsoft.Identity.Client;
138138
IConfidentialClientApplication app;
139139
```
@@ -161,7 +161,7 @@ Here is the code to instantiate the confidential client application with a clien
161161

162162
# [.NET](#tab/dotnet)
163163

164-
```CSharp
164+
```csharp
165165
app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
166166
.WithClientSecret(config.ClientSecret)
167167
.WithAuthority(new Uri(config.Authority))
@@ -201,7 +201,7 @@ Here is the code to build an application with a certificate:
201201

202202
# [.NET](#tab/dotnet)
203203

204-
```CSharp
204+
```csharp
205205
X509Certificate2 certificate = ReadCertificate(config.CertificateName);
206206
app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
207207
.WithCertificate(certificate)
@@ -268,7 +268,7 @@ MSAL.NET has two methods to provide signed assertions to the confidential client
268268

269269
When you use `WithClientAssertion`, you need to provide a signed JWT. This advanced scenario is detailed in [Client assertions](msal-net-client-assertions.md)
270270

271-
```CSharp
271+
```csharp
272272
string signedClientAssertion = ComputeAssertion();
273273
app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
274274
.WithClientAssertion(signedClientAssertion)
@@ -278,7 +278,7 @@ app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
278278
When you use `WithClientClaims`, MSAL.NET will compute itself a signed assertion containing the claims expected by Azure AD plus additional client claims that you want to send.
279279
Here is a code snippet on how to do that:
280280

281-
```CSharp
281+
```csharp
282282
string ipAddress = "192.168.1.2";
283283
var claims = new Dictionary<string, string> { { "client_ip", ipAddress } };
284284
X509Certificate2 certificate = ReadCertificate(config.CertificateName);

0 commit comments

Comments
 (0)