Skip to content

Commit

Permalink
Fix for #506
Browse files Browse the repository at this point in the history
Separate Microsoft Graph support from Microsoft.Identity.web

Needs more work on templates.
  • Loading branch information
jmprieur committed Sep 1, 2020
1 parent 875468f commit 080d112
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 64 deletions.
12 changes: 12 additions & 0 deletions Microsoft.Identity.Web.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions src/Microsoft.Identity.Web.MicrosoftGraph/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Microsoft.Identity.Web
{
/// <summary>
/// General constants.
/// </summary>
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";
}
}
13 changes: 13 additions & 0 deletions src/Microsoft.Identity.Web.MicrosoftGraph/IDWebErrorMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Microsoft.Identity.Web
{
/// <summary>
/// Constants related to the error messages.
/// </summary>
internal static class IDWebErrorMessage
{
public const string CalledApiScopesAreNull = "IDW10207: The CalledApiScopes cannot be null. ";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>

<!--This should be passed from the VSTS build-->
<ClientSemVer Condition="'$(ClientSemVer)' == ''">0.4.0-localbuild</ClientSemVer>
<!--This will generate AssemblyVersion, AssemblyFileVersion and AssemblyInformationVersion-->
<Version>$(ClientSemVer)</Version>

<DefineConstants>$(DefineConstants);WEB</DefineConstants>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<!-- Copyright needs to be in the form of © not (c) to be compliant -->
<Title>Microsoft Identity Web, Microsoft Graph helper</Title>
<Authors>Microsoft</Authors>
<Company>Microsoft Corporation</Company>
<Product>Microsoft Identity Web</Product>
<Description>
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.
</Description>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/AzureAD/microsoft-identity-web</PackageProjectUrl>
<RepositoryUrl>https://github.com/AzureAD/microsoft-identity-web</RepositoryUrl>
<PackageReleaseNotes>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 </PackageReleaseNotes>
<PackageTags>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</PackageTags>
</PropertyGroup>
<PropertyGroup Label="Source Link">
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="..\..\stylecop.json" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

<ItemGroup Label="Build Tools" Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Graph" Version="3.12.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
</ItemGroup>

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1; net5.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../../build/MSAL.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<!-- The MSAL.snk has both private and public keys -->
<DelaySign>false</DelaySign>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>

<!--This should be passed from the VSTS build-->
<ClientSemVer Condition="'$(ClientSemVer)' == ''">0.4.0-localbuild</ClientSemVer>
<!--This will generate AssemblyVersion, AssemblyFileVersion and AssemblyInformationVersion-->
<Version>$(ClientSemVer)</Version>

<DefineConstants>$(DefineConstants);WEB</DefineConstants>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<!-- Copyright needs to be in the form of © not (c) to be compliant -->
<Title>Microsoft Identity Web, Microsoft Graph helper</Title>
<Authors>Microsoft</Authors>
<Company>Microsoft Corporation</Company>
<Product>Microsoft Identity Web</Product>
<Description>
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.
</Description>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/AzureAD/microsoft-identity-web</PackageProjectUrl>
<RepositoryUrl>https://github.com/AzureAD/microsoft-identity-web</RepositoryUrl>
<PackageReleaseNotes>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 </PackageReleaseNotes>
<PackageTags>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</PackageTags>
</PropertyGroup>
<PropertyGroup Label="Source Link">
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="..\..\stylecop.json" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\Microsoft.Identity.Web.MicrosoftGraph\Constants.cs" Link="Constants.cs" />
<Compile Include="..\Microsoft.Identity.Web.MicrosoftGraph\IDWebErrorMessage.cs" Link="IDWebErrorMessage.cs" />
<Compile Include="..\Microsoft.Identity.Web.MicrosoftGraph\MicrosoftGraphExtensions.cs" Link="MicrosoftGraphExtensions.cs" />
<Compile Include="..\Microsoft.Identity.Web.MicrosoftGraph\MicrosoftGraphOptions.cs" Link="MicrosoftGraphOptions.cs" />
<Compile Include="..\Microsoft.Identity.Web.MicrosoftGraph\TokenAcquisitionCredentialProvider.cs" Link="TokenAcquisitionCredentialProvider.cs" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

<ItemGroup Label="Build Tools" Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Graph.Beta" Version="0.25.0-preview" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
</ItemGroup>

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1; net5.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../../build/MSAL.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<!-- The MSAL.snk has both private and public keys -->
<DelaySign>false</DelaySign>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.Identity.Web
{
/// <summary>
/// Options passed-in to call downstream web APIs. To call Microsoft Graph, see rather
/// <see cref="MicrosoftGraphOptions"/>.
/// <c>MicrosoftGraphOptions"</c> in the <c>Microsoft.Identity.Web.MicrosoftGraph</c> assembly.
/// </summary>
public class DownstreamWebApiOptions
{
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Graph" Version="3.9.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.17.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164">
<PrivateAssets>all</PrivateAssets>
Expand Down
63 changes: 1 addition & 62 deletions src/Microsoft.Identity.Web/Microsoft.Identity.Web.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/BlazorServerCallsGraph/blazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<UserSecretsId>66e5c3c7-f757-4032-bfcf-68bd81948618</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Identity.Web.MicrosoftGraph\Microsoft.Identity.Web.MicrosoftGraph.csproj" />
<ProjectReference Include="..\..\src\Microsoft.Identity.Web.UI\Microsoft.Identity.Web.UI.csproj" />
<ProjectReference Include="..\..\src\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Identity.Web.MicrosoftGraph\Microsoft.Identity.Web.MicrosoftGraph.csproj" />
<ProjectReference Include="..\..\src\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
<ProjectReference Include="..\Microsoft.Identity.Web.Test.Common\Microsoft.Identity.Web.Test.Common.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<UserSecretsId>aspnet-WebApp_OpenIDConnect_DotNet-81EA87AD-E64D-4755-A1CC-5EA47F49B5D8</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Identity.Web.MicrosoftGraph\Microsoft.Identity.Web.MicrosoftGraph.csproj" />
<ProjectReference Include="..\..\src\Microsoft.Identity.Web.UI\Microsoft.Identity.Web.UI.csproj" />
<ProjectReference Include="..\..\src\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Microsoft.Identity.Web.MicrosoftGraph\Microsoft.Identity.Web.MicrosoftGraph.csproj" />
<ProjectReference Include="..\..\..\src\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
</ItemGroup>

Expand Down

0 comments on commit 080d112

Please sign in to comment.