diff --git a/Microsoft.Identity.Web.sln b/Microsoft.Identity.Web.sln index 17dd4af1c..c6208899d 100644 --- a/Microsoft.Identity.Web.sln +++ b/Microsoft.Identity.Web.sln @@ -77,6 +77,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "blazorwasm2-b2c-hosted.Clie EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "blazorwasm2-b2c-hosted.Server", "tests\blazorwasm2-b2c-hosted\Server\blazorwasm2-b2c-hosted.Server.csproj", "{69ECC686-3077-4E46-97F6-D287A4821FD4}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Identity.Web.MicrosoftGraph", "src\Microsoft.Identity.Web.MicrosoftGraph\Microsoft.Identity.Web.MicrosoftGraph.csproj", "{9A736AA6-54DD-47E0-85D9-3CFEE2CDD92A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Identity.Web.MicrosoftGraphBeta", "src\Microsoft.Identity.Web.MicrosoftGraphBeta\Microsoft.Identity.Web.MicrosoftGraphBeta.csproj", "{B68226EF-2A43-4040-A583-061F25A4DE21}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -167,6 +171,14 @@ Global {69ECC686-3077-4E46-97F6-D287A4821FD4}.Debug|Any CPU.Build.0 = Debug|Any CPU {69ECC686-3077-4E46-97F6-D287A4821FD4}.Release|Any CPU.ActiveCfg = Release|Any CPU {69ECC686-3077-4E46-97F6-D287A4821FD4}.Release|Any CPU.Build.0 = Release|Any CPU + {9A736AA6-54DD-47E0-85D9-3CFEE2CDD92A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A736AA6-54DD-47E0-85D9-3CFEE2CDD92A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A736AA6-54DD-47E0-85D9-3CFEE2CDD92A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A736AA6-54DD-47E0-85D9-3CFEE2CDD92A}.Release|Any CPU.Build.0 = Release|Any CPU + {B68226EF-2A43-4040-A583-061F25A4DE21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B68226EF-2A43-4040-A583-061F25A4DE21}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B68226EF-2A43-4040-A583-061F25A4DE21}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B68226EF-2A43-4040-A583-061F25A4DE21}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Microsoft.Identity.Web.MicrosoftGraph/Constants.cs b/src/Microsoft.Identity.Web.MicrosoftGraph/Constants.cs new file mode 100644 index 000000000..b20f454ca --- /dev/null +++ b/src/Microsoft.Identity.Web.MicrosoftGraph/Constants.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Identity.Web +{ + /// + /// General constants. + /// + internal static class Constants + { + public const string Authorization = "Authorization"; + public const string Bearer = "Bearer"; + + // Microsoft Graph + public const string UserReadScope = "user.read"; + public const string GraphBaseUrlV1 = "https://graph.microsoft.com/v1.0"; + } +} diff --git a/src/Microsoft.Identity.Web.MicrosoftGraph/IDWebErrorMessage.cs b/src/Microsoft.Identity.Web.MicrosoftGraph/IDWebErrorMessage.cs new file mode 100644 index 000000000..29c6329db --- /dev/null +++ b/src/Microsoft.Identity.Web.MicrosoftGraph/IDWebErrorMessage.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Identity.Web +{ + /// + /// Constants related to the error messages. + /// + internal static class IDWebErrorMessage + { + public const string CalledApiScopesAreNull = "IDW10207: The CalledApiScopes cannot be null. "; + } +} diff --git a/src/Microsoft.Identity.Web.MicrosoftGraph/Microsoft.Identity.Web.MicrosoftGraph.csproj b/src/Microsoft.Identity.Web.MicrosoftGraph/Microsoft.Identity.Web.MicrosoftGraph.csproj new file mode 100644 index 000000000..b5a3b6ce7 --- /dev/null +++ b/src/Microsoft.Identity.Web.MicrosoftGraph/Microsoft.Identity.Web.MicrosoftGraph.csproj @@ -0,0 +1,71 @@ + + + + + 0.4.0-localbuild + + $(ClientSemVer) + + $(DefineConstants);WEB + true + + Microsoft Identity Web, Microsoft Graph helper + Microsoft + Microsoft Corporation + Microsoft Identity Web + + This package enables ASP.NET Core Web apps and Web APIs to use the Microsoft identity platform (formerly Azure AD v2.0). + This package is specifically used for web applications, which sign-in users, and protected web APIs, call Microsoft Graph. + + © Microsoft Corporation. All rights reserved. + MIT + https://github.com/AzureAD/microsoft-identity-web + https://github.com/AzureAD/microsoft-identity-web + The release notes are available at https://github.com/AzureAD/microsoft-identity-web/releases and the roadmap at https://github.com/AzureAD/microsoft-identity-web/wiki#roadmap + Microsoft Identity Web;Microsoft identity platform;Microsoft.Identity.Web;.NET;ASP.NET Core;Web App;Web API;B2C;Azure Active Directory;AAD;Identity;Authentication;Authorization + + + true + true + + true + snupkg + + + + + + + + + True + + + + + + + + + + + + + + + + + + netcoreapp3.1; net5.0 + true + ../../build/MSAL.snk + true + enable + + + + + false + + + diff --git a/src/Microsoft.Identity.Web/MicrosoftGraph/MicrosoftGraphExtensions.cs b/src/Microsoft.Identity.Web.MicrosoftGraph/MicrosoftGraphExtensions.cs similarity index 100% rename from src/Microsoft.Identity.Web/MicrosoftGraph/MicrosoftGraphExtensions.cs rename to src/Microsoft.Identity.Web.MicrosoftGraph/MicrosoftGraphExtensions.cs diff --git a/src/Microsoft.Identity.Web/MicrosoftGraph/MicrosoftGraphOptions.cs b/src/Microsoft.Identity.Web.MicrosoftGraph/MicrosoftGraphOptions.cs similarity index 100% rename from src/Microsoft.Identity.Web/MicrosoftGraph/MicrosoftGraphOptions.cs rename to src/Microsoft.Identity.Web.MicrosoftGraph/MicrosoftGraphOptions.cs diff --git a/src/Microsoft.Identity.Web/MicrosoftGraph/TokenAcquisitionCredentialProvider.cs b/src/Microsoft.Identity.Web.MicrosoftGraph/TokenAcquisitionCredentialProvider.cs similarity index 100% rename from src/Microsoft.Identity.Web/MicrosoftGraph/TokenAcquisitionCredentialProvider.cs rename to src/Microsoft.Identity.Web.MicrosoftGraph/TokenAcquisitionCredentialProvider.cs diff --git a/src/Microsoft.Identity.Web.MicrosoftGraphBeta/Microsoft.Identity.Web.MicrosoftGraphBeta.csproj b/src/Microsoft.Identity.Web.MicrosoftGraphBeta/Microsoft.Identity.Web.MicrosoftGraphBeta.csproj new file mode 100644 index 000000000..442505df8 --- /dev/null +++ b/src/Microsoft.Identity.Web.MicrosoftGraphBeta/Microsoft.Identity.Web.MicrosoftGraphBeta.csproj @@ -0,0 +1,79 @@ + + + + + 0.4.0-localbuild + + $(ClientSemVer) + + $(DefineConstants);WEB + true + + Microsoft Identity Web, Microsoft Graph helper + Microsoft + Microsoft Corporation + Microsoft Identity Web + + This package enables ASP.NET Core Web apps and Web APIs to use the Microsoft identity platform (formerly Azure AD v2.0). + This package is specifically used for web applications, which sign-in users, and protected web APIs, call Microsoft Graph Beta API. + + © Microsoft Corporation. All rights reserved. + MIT + https://github.com/AzureAD/microsoft-identity-web + https://github.com/AzureAD/microsoft-identity-web + The release notes are available at https://github.com/AzureAD/microsoft-identity-web/releases and the roadmap at https://github.com/AzureAD/microsoft-identity-web/wiki#roadmap + Microsoft Identity Web;Microsoft identity platform;Microsoft.Identity.Web;.NET;ASP.NET Core;Web App;Web API;B2C;Azure Active Directory;AAD;Identity;Authentication;Authorization + + + true + true + + true + snupkg + + + + + + + + + + + + + + + + + True + + + + + + + + + + + + + + + + + + netcoreapp3.1; net5.0 + true + ../../build/MSAL.snk + true + enable + + + + + false + + + diff --git a/src/Microsoft.Identity.Web/DownstreamWebApiSupport/DownstreamWebApiOptions.cs b/src/Microsoft.Identity.Web/DownstreamWebApiSupport/DownstreamWebApiOptions.cs index c040c0777..dec4da9d7 100644 --- a/src/Microsoft.Identity.Web/DownstreamWebApiSupport/DownstreamWebApiOptions.cs +++ b/src/Microsoft.Identity.Web/DownstreamWebApiSupport/DownstreamWebApiOptions.cs @@ -7,7 +7,7 @@ namespace Microsoft.Identity.Web { /// /// Options passed-in to call downstream web APIs. To call Microsoft Graph, see rather - /// . + /// MicrosoftGraphOptions" in the Microsoft.Identity.Web.MicrosoftGraph assembly. /// public class DownstreamWebApiOptions { diff --git a/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj b/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj index 216f460e6..d2851fa23 100644 --- a/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj +++ b/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj @@ -94,7 +94,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - all diff --git a/src/Microsoft.Identity.Web/Microsoft.Identity.Web.xml b/src/Microsoft.Identity.Web/Microsoft.Identity.Web.xml index 0b11bfad0..142fc5699 100644 --- a/src/Microsoft.Identity.Web/Microsoft.Identity.Web.xml +++ b/src/Microsoft.Identity.Web/Microsoft.Identity.Web.xml @@ -588,7 +588,7 @@ Options passed-in to call downstream web APIs. To call Microsoft Graph, see rather - . + MicrosoftGraphOptions" in the Microsoft.Identity.Web.MicrosoftGraph assembly. @@ -927,67 +927,6 @@ OpenID Connect event. A that represents a completed remove from cache operation. - - - Extensions methods on a MicrosoftIdentityAppCallingWebApiAuthenticationBuilder builder - to add support to call Microsoft Graph. - - - - - Add support to call Microsoft Graph. From a named option and a configuration section. - - Builder. - Configuration section. - The builder to chain. - - - - Add support to call Microsoft Graph. From a base Graph URL and a default scope. - - Builder. - Named instance of option. - Configuration section. - The builder to chain. - - - - Add support to call Microsoft Graph. From a named options and a configuration method. - - Builder. - Method to configure the options. - The builder to chain. - - - - Options passed-in to call Microsoft Graph. - - - - - Base URL for the Microsoft Graph API. By default: "https://graph.microsoft.com/v1.0/" - but it can be changed to use the Microsoft Graph Beta endpoint or national cloud versions - of MicrosoftGraph. - - - - - Space separated scopes used to call Microsoft Graph, - for instance user.read mail.read. - - - - - Authentication provider based on ITokenAcquisition. - - - - - Adds a bearer header to an HttpRequestMessage. - - HttpRequest message to authenticate. - A Task (as this is an async method). - Base class for Web app and Web API Microsoft Identity authentication diff --git a/tests/BlazorServerCallsGraph/blazor.csproj b/tests/BlazorServerCallsGraph/blazor.csproj index 6f39697f6..fbf018d78 100644 --- a/tests/BlazorServerCallsGraph/blazor.csproj +++ b/tests/BlazorServerCallsGraph/blazor.csproj @@ -4,6 +4,7 @@ 66e5c3c7-f757-4032-bfcf-68bd81948618 + diff --git a/tests/Microsoft.Identity.Web.Test/Microsoft.Identity.Web.Test.csproj b/tests/Microsoft.Identity.Web.Test/Microsoft.Identity.Web.Test.csproj index 94c11bab8..5707719e1 100644 --- a/tests/Microsoft.Identity.Web.Test/Microsoft.Identity.Web.Test.csproj +++ b/tests/Microsoft.Identity.Web.Test/Microsoft.Identity.Web.Test.csproj @@ -38,6 +38,7 @@ + diff --git a/tests/WebAppCallsMicrosoftGraph/WebAppCallsMicrosoftGraph.csproj b/tests/WebAppCallsMicrosoftGraph/WebAppCallsMicrosoftGraph.csproj index 7cad3f275..2a3d90149 100644 --- a/tests/WebAppCallsMicrosoftGraph/WebAppCallsMicrosoftGraph.csproj +++ b/tests/WebAppCallsMicrosoftGraph/WebAppCallsMicrosoftGraph.csproj @@ -4,6 +4,7 @@ aspnet-WebApp_OpenIDConnect_DotNet-81EA87AD-E64D-4755-A1CC-5EA47F49B5D8 + diff --git a/tests/WebAppCallsWebApiCallsGraph/TodoListService/TodoListService.csproj b/tests/WebAppCallsWebApiCallsGraph/TodoListService/TodoListService.csproj index fb0389417..50014080b 100644 --- a/tests/WebAppCallsWebApiCallsGraph/TodoListService/TodoListService.csproj +++ b/tests/WebAppCallsWebApiCallsGraph/TodoListService/TodoListService.csproj @@ -7,6 +7,7 @@ +