-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from windows-toolkit/shweaver/bad-behaviors
Restructuring package layout, removing behaviors
- Loading branch information
Showing
85 changed files
with
560 additions
and
1,812 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
CommunityToolkit.Net.Authentication.Msal/CommunityToolkit.Net.Authentication.Msal.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
|
||
<Title>Windows Community Toolkit .NET Standard Auth Services</Title> | ||
<Description> | ||
This package includes .NET Standard authentication helpers such as: | ||
- MsalProvider: | ||
</Description> | ||
<PackageTags>Community Toolkit Provider Authentication Auth Msal</PackageTags> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Identity.Client" Version="4.28.0" /> | ||
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="2.18.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\CommunityToolkit.Net.Authentication\CommunityToolkit.Net.Authentication.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using CommunityToolkit.Net.Authentication.Extensions; | ||
|
||
namespace CommunityToolkit.Net.Authentication | ||
{ | ||
/// <summary> | ||
/// A base construct for building Graph Providers on top of. | ||
/// </summary> | ||
public abstract class BaseProvider : IProvider | ||
{ | ||
private ProviderState _state; | ||
|
||
/// <summary> | ||
/// Gets or sets the current state of the provider. | ||
/// </summary> | ||
public ProviderState State | ||
{ | ||
get => _state; | ||
protected set | ||
{ | ||
var oldState = _state; | ||
var newState = value; | ||
if (oldState != newState) | ||
{ | ||
_state = newState; | ||
StateChanged?.Invoke(this, new ProviderStateChangedEventArgs(oldState, newState)); | ||
} | ||
} | ||
} | ||
|
||
/// <inheritdoc/> | ||
public event EventHandler<ProviderStateChangedEventArgs> StateChanged; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BaseProvider"/> class. | ||
/// </summary> | ||
public BaseProvider() | ||
{ | ||
_state = ProviderState.Loading; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public abstract Task LoginAsync(); | ||
|
||
/// <inheritdoc /> | ||
public abstract Task LogoutAsync(); | ||
|
||
/// <inheritdoc /> | ||
public abstract Task AuthenticateRequestAsync(HttpRequestMessage request); | ||
|
||
/// <summary> | ||
/// Append the Sdk version to the request headers. | ||
/// </summary> | ||
/// <param name="request"> | ||
/// The request to append the header to. | ||
/// </param> | ||
protected void AddSdkVersion(HttpRequestMessage request) | ||
{ | ||
request.AddSdkVersion(); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
CommunityToolkit.Net.Authentication/CommunityToolkit.Net.Authentication.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
|
||
<Title>Windows Community Toolkit .NET Standard Auth Services</Title> | ||
<Description> | ||
This package includes .NET Standard authentication helpers such as: | ||
- BaseProvider: | ||
- IProvider: | ||
- MockPRovider: | ||
- ProviderManager: | ||
- ProviderManagerChangedState: | ||
- ProviderState: | ||
- ProviderStateChangedEventArgs: | ||
- ProviderUpdatedEventArgs: | ||
</Description> | ||
<PackageTags>Community Toolkit Provider Authentication Auth</PackageTags> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.