Skip to content

Commit fc1c2d9

Browse files
authored
Merge pull request #331 from Azure-Samples/jennyf/addNuget
[do not merge] update samples to take Microsoft Identity Web as a nuget package
2 parents ab39e6a + 804074c commit fc1c2d9

File tree

118 files changed

+160
-6704
lines changed

Some content is hidden

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

118 files changed

+160
-6704
lines changed

1-WebApp-OIDC/1-1-MyOrg/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ cd "1-WebApp-OIDC\1-1-MyOrg"
144144
> Note: Replace *`Enter_the_Application_Id_here`* with the *Application Id* from the application Id you just registered in the Application Registration Portal and *`<yourTenantId>`* with the *Directory (tenant) ID* where you created your application.
145145

146146
1. Open the generated project (.csproj) in Visual Studio, and save the solution.
147-
1. Add the `Microsoft.Identity.Web.csproj` project which is located at the root of this sample repo, to your solution (**Add Existing Project ...**). It's used to simplify signing-in and, in the next tutorial phases, to get a token
148-
1. Add a reference from your newly generated project to `Microsoft.Identity.Web` (right click on the **Dependencies** node under your new project, and choose **Add Reference ...**, and then in the projects tab find the `Microsoft.Identity.Web` project)
147+
1. Add the `Microsoft.Identity.Web` NuGet package. It's used to simplify signing-in and, in the next tutorial phases, to get a token.
149148
1. Open the **Startup.cs** file and:
150149
151150
- at the top of the file, add the following using directive:
@@ -164,8 +163,7 @@ cd "1-WebApp-OIDC\1-1-MyOrg"
164163
by this line:
165164
166165
```CSharp
167-
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
168-
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
166+
services.AddSignIn(Configuration);
169167
```
170168
171169
This enables your application to use the Microsoft identity platform endpoint. This endpoint is capable of signing-in users both with their Work and School and Microsoft Personal accounts.

1-WebApp-OIDC/1-1-MyOrg/Startup.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ public void ConfigureServices(IServiceCollection services)
3434
});
3535

3636
// Sign-in users with the Microsoft identity platform
37-
//services.AddSignIn(Configuration);
38-
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
39-
.AddSignIn("AzureAD", Configuration, options => Configuration.Bind("AzureAD", options));
37+
services.AddSignIn(Configuration);
4038

4139
services.AddControllersWithViews(options =>
4240
{

1-WebApp-OIDC/1-1-MyOrg/WebApp-OpenIDConnect-DotNet.csproj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2626
</PackageReference>
2727
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
28+
<PackageReference Include="Microsoft.Identity.Web" Version="0.1.0-preview" />
29+
<PackageReference Include="Microsoft.Identity.Web.UI" Version="0.1.0-preview" />
2830
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
2931
</ItemGroup>
3032

31-
<ItemGroup>
32-
<ProjectReference Include="..\..\Microsoft.Identity.Web.UI\Microsoft.Identity.Web.UI.csproj" />
33-
<ProjectReference Include="..\..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
34-
</ItemGroup>
35-
3633
</Project>

1-WebApp-OIDC/1-1-MyOrg/WebApp-OpenIDConnect-DotNet.sln

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ VisualStudioVersion = 16.0.29519.87
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApp-OpenIDConnect-DotNet", "WebApp-OpenIDConnect-DotNet.csproj", "{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Identity.Web", "..\..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj", "{E0CEF26A-6CE6-4505-851B-6580D5564752}"
9-
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Identity.Web.UI", "..\..\Microsoft.Identity.Web.UI\Microsoft.Identity.Web.UI.csproj", "{57CF1884-743D-4BF3-B14B-4F8660469038}"
11-
EndProject
128
Global
139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1410
Debug|Any CPU = Debug|Any CPU
@@ -19,14 +15,6 @@ Global
1915
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
2016
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
2117
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Release|Any CPU.Build.0 = Release|Any CPU
22-
{E0CEF26A-6CE6-4505-851B-6580D5564752}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23-
{E0CEF26A-6CE6-4505-851B-6580D5564752}.Debug|Any CPU.Build.0 = Debug|Any CPU
24-
{E0CEF26A-6CE6-4505-851B-6580D5564752}.Release|Any CPU.ActiveCfg = Release|Any CPU
25-
{E0CEF26A-6CE6-4505-851B-6580D5564752}.Release|Any CPU.Build.0 = Release|Any CPU
26-
{57CF1884-743D-4BF3-B14B-4F8660469038}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27-
{57CF1884-743D-4BF3-B14B-4F8660469038}.Debug|Any CPU.Build.0 = Debug|Any CPU
28-
{57CF1884-743D-4BF3-B14B-4F8660469038}.Release|Any CPU.ActiveCfg = Release|Any CPU
29-
{57CF1884-743D-4BF3-B14B-4F8660469038}.Release|Any CPU.Build.0 = Release|Any CPU
3018
EndGlobalSection
3119
GlobalSection(SolutionProperties) = preSolution
3220
HideSolutionNode = FALSE

1-WebApp-OIDC/1-2-AnyOrg/README-1-1-to-1-2.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,12 @@ In the `Startup.cs` file, in the `ConfigureServices` method, after `services.Add
6464
{
6565
...
6666
// Sign-in users with the Microsoft identity platform
67-
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
68-
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
69-
70-
// Restrict users to specific belonging to specific tenants
71-
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
67+
services.AddSignIn(Configuration, options =>
7268
{
69+
Configuration.Bind("AzureAd", options);
70+
// Restrict users to specific belonging to specific tenants
7371
options.TokenValidationParameters.IssuerValidator = ValidateSpecificIssuers;
74-
});
72+
}, options => Configuration.Bind("AzureAd", options));
7573
...
7674
```
7775

1-WebApp-OIDC/1-2-AnyOrg/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ cd "1-WebApp-OIDC\1-2-AnyOrg"
136136
> Note: Replace *`Enter_the_Application_Id_here`* with the *Application Id* from the application Id you just registered in the Application Registration Portal.
137137

138138
1. Open the generated project (.csproj) in Visual Studio, and save the solution.
139-
1. Add the `Microsoft.Identity.Web.csproj` project which is located at the root of this sample repo, to your solution (**Add Existing Project ...**). It's used to simplify signing-in and, in the next tutorial phases, to get a token
140-
1. Add a reference from your newly generated project to `Microsoft.Identity.Web` (right click on the **Dependencies** node under your new project, and choose **Add Reference ...**, and then in the projects tab find the `Microsoft.Identity.Web` project)
139+
1. Add the `Microsoft.Identity.Web` NuGet package. It's used to simplify signing-in and, in the next tutorial phases, to get a token.
141140
1. Open the **Startup.cs** file and:
142141
143142
- at the top of the file, add the following using directive:
@@ -156,8 +155,7 @@ cd "1-WebApp-OIDC\1-2-AnyOrg"
156155
by this line:
157156
158157
```CSharp
159-
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
160-
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
158+
services.AddSignIn(Configuration);
161159
```
162160
163161
This enables your application to use the Microsoft identity platform endpoint. This endpoint is capable of signing-in users both with their Work and School and Microsoft Personal accounts.
@@ -178,7 +176,7 @@ cd "1-WebApp-OIDC\1-2-AnyOrg"
178176
179177
ASP.NET core applications create session cookies that represent the identity of the caller. Some Safari users using iOS 12 had issues which are described in [ASP.NET Core #4467](https://github.com/aspnet/AspNetCore/issues/4647) and the Web kit bugs database [Bug 188165 - iOS 12 Safari breaks ASP.NET Core 2.1 OIDC authentication](https://bugs.webkit.org/show_bug.cgi?id=188165).
180178
181-
If your web site needs to be accessed from users using iOS 12, you probably want to disable the SameSite protection, but also ensure that state changes are protected with CSRF anti-forgery mecanism. See the how to fix section of [Microsoft Security Advisory: iOS12 breaks social, WSFed and OIDC logins #4647](https://github.com/aspnet/AspNetCore/issues/4647)
179+
If your web site needs to be accessed from users using iOS 12, you probably want to disable the SameSite protection, but also ensure that state changes are protected with CSRF anti-forgery mechanism. See the how to fix section of [Microsoft Security Advisory: iOS12 breaks social, WSFed and OIDC logins #4647](https://github.com/aspnet/AspNetCore/issues/4647)
182180
183181
> Did the sample not work for you as expected? Did you encounter issues trying this sample? Then please reach out to us using the [GitHub Issues](../../../../issues) page.
184182

1-WebApp-OIDC/1-2-AnyOrg/Startup.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public void ConfigureServices(IServiceCollection services)
3434
});
3535

3636
// Sign-in users with the Microsoft identity platform
37-
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
38-
.AddSignIn("AzureAD", Configuration, options => Configuration.Bind("AzureAD", options));
37+
services.AddSignIn(Configuration);
3938

4039
services.AddControllersWithViews(options =>
4140
{

1-WebApp-OIDC/1-2-AnyOrg/WebApp-OpenIDConnect-DotNet.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
</ItemGroup>
1919

2020
<ItemGroup>
21-
<ProjectReference Include="..\..\Microsoft.Identity.Web.UI\Microsoft.Identity.Web.UI.csproj" />
22-
<ProjectReference Include="..\..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
21+
<PackageReference Include="Microsoft.Identity.Web" Version="0.1.0-preview" />
22+
<PackageReference Include="Microsoft.Identity.Web.UI" Version="0.1.0-preview" />
2323
</ItemGroup>
2424

2525
</Project>

1-WebApp-OIDC/1-2-AnyOrg/WebApp-OpenIDConnect-DotNet.sln

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ VisualStudioVersion = 16.0.29709.97
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApp-OpenIDConnect-DotNet", "WebApp-OpenIDConnect-DotNet.csproj", "{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Identity.Web", "..\..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj", "{E0CEF26A-6CE6-4505-851B-6580D5564752}"
9-
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Identity.Web.UI", "..\..\Microsoft.Identity.Web.UI\Microsoft.Identity.Web.UI.csproj", "{32BCFB8C-7DF5-43D2-9B39-C48B4B707E0E}"
11-
EndProject
128
Global
139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1410
Debug|Any CPU = Debug|Any CPU
@@ -19,14 +15,6 @@ Global
1915
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
2016
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
2117
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Release|Any CPU.Build.0 = Release|Any CPU
22-
{E0CEF26A-6CE6-4505-851B-6580D5564752}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23-
{E0CEF26A-6CE6-4505-851B-6580D5564752}.Debug|Any CPU.Build.0 = Debug|Any CPU
24-
{E0CEF26A-6CE6-4505-851B-6580D5564752}.Release|Any CPU.ActiveCfg = Release|Any CPU
25-
{E0CEF26A-6CE6-4505-851B-6580D5564752}.Release|Any CPU.Build.0 = Release|Any CPU
26-
{32BCFB8C-7DF5-43D2-9B39-C48B4B707E0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27-
{32BCFB8C-7DF5-43D2-9B39-C48B4B707E0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
28-
{32BCFB8C-7DF5-43D2-9B39-C48B4B707E0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
29-
{32BCFB8C-7DF5-43D2-9B39-C48B4B707E0E}.Release|Any CPU.Build.0 = Release|Any CPU
3018
EndGlobalSection
3119
GlobalSection(SolutionProperties) = preSolution
3220
HideSolutionNode = FALSE

1-WebApp-OIDC/1-3-AnyOrgOrPersonal/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ There is one project in this sample. To register it, you can:
4343
3. Run the following script to create and configure your Azure AD application and configure the code of the sample application as well.
4444
4545
```PowerShell
46-
cd .\AppCreationScripts\
47-
.\Configure.ps1
46+
cd .\AppCreationScripts\
47+
.\Configure.ps1
4848
```
4949
5050
> Other ways of running the scripts are described in [App Creation Scripts](./AppCreationScripts/AppCreationScripts.md)
@@ -131,8 +131,7 @@ In the **appsettings.json** file:
131131
> Note: Replace *`Enter_the_Application_Id_here`* with the *Application Id* from the application Id you just registered in the Application Registration Portal.
132132

133133
1. Open the generated project (.csproj) in Visual Studio, and save the solution.
134-
1. Add the `Microsoft.Identity.Web.csproj` project which is located at the root of this sample repo, to your solution (**Add Existing Project ...**). It's used to simplify signing-in and, in the next tutorial phases, to get a token.
135-
1. Add a reference from your newly generated project to `Microsoft.Identity.Web` (right click on the **Dependencies** node under your new project, and choose **Add Reference ...**, and then in the projects tab find the `Microsoft.Identity.Web` project)
134+
1. Add the `Microsoft.Identity.Web` NuGet package. It's used to simplify signing-in and, in the next tutorial phases, to get a token.
136135
1. Open the **Startup.cs** file and:
137136
138137
- at the top of the file, add the following using directive:
@@ -151,8 +150,7 @@ In the **appsettings.json** file:
151150
by this line:
152151
153152
```CSharp
154-
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
155-
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
153+
services.AddSignIn(Configuration);
156154
```
157155
158156
This enables your application to use the Microsoft identity platform endpoint. This endpoint is capable of signing-in users both with their Work and School and Microsoft Personal accounts.
@@ -215,7 +213,7 @@ See restrict restrict users from [specific organizations](../1-2-AnyOrg/README-1
215213
216214
ASP.NET core applications create session cookies that represent the identity of the caller. Some Safari users using iOS 12 had issues which are described in [ASP.NET Core #4467](https://github.com/aspnet/AspNetCore/issues/4647) and the Web kit bugs database [Bug 188165 - iOS 12 Safari breaks ASP.NET Core 2.1 OIDC authentication](https://bugs.webkit.org/show_bug.cgi?id=188165).
217215
218-
If your web site needs to be accessed from users using iOS 12, you probably want to disable the SameSite protection, but also ensure that state changes are protected with CSRF anti-forgery mecanism. See the how to fix section of [Microsoft Security Advisory: iOS12 breaks social, WSFed and OIDC logins #4647](https://github.com/aspnet/AspNetCore/issues/4647)
216+
If your web site needs to be accessed from users using iOS 12, you probably want to disable the SameSite protection, but also ensure that state changes are protected with CSRF anti-forgery mechanism. See the how to fix section of [Microsoft Security Advisory: iOS12 breaks social, WSFed and OIDC logins #4647](https://github.com/aspnet/AspNetCore/issues/4647)
219217
220218
> Did the sample not work for you as expected? Did you encounter issues trying this sample? Then please reach out to us using the [GitHub Issues](../../../../issues) page.
221219

0 commit comments

Comments
 (0)