-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
189930d
commit f719903
Showing
5 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
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,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.5.33424.131 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EAVFW.Extensions.EasyAuth.MicrosoftEntraId", "src\EAVFW.Extensions.EasyAuth.MicrosoftEntraId\EAVFW.Extensions.EasyAuth.MicrosoftEntraId.csproj", "{421B39D9-314A-4B5E-8489-A526850EBFC0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{421B39D9-314A-4B5E-8489-A526850EBFC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{421B39D9-314A-4B5E-8489-A526850EBFC0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{421B39D9-314A-4B5E-8489-A526850EBFC0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{421B39D9-314A-4B5E-8489-A526850EBFC0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {032BC2FD-02E8-4D8D-AC63-DA74495A5D01} | ||
EndGlobalSection | ||
EndGlobal |
27 changes: 27 additions & 0 deletions
27
...FW.Extensions.EasyAuth.MicrosoftEntraId/EAVFW.Extensions.EasyAuth.MicrosoftEntraId.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,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net6.0</TargetFrameworks> | ||
|
||
<Title>EAVFW.Extensions.EasyAuth.MicrosoftEntraId</Title> | ||
<Authors>Poul Kjeldager</Authors> | ||
<Description>EAVFW.Extensions.EasyAuth.MicrosoftEntraId</Description> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/EAVFW/EAVFW.Extensions.EasyAuth.MicrosoftEntraId</RepositoryUrl> | ||
<RemoteEAVFramework>$(UseEAVFromNuget)</RemoteEAVFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="$(RemoteEAVFramework) != 'false'"> | ||
<ProjectReference Include="$(LocalEAVFrameworkPath)\src\EAVFramework.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="$(RemoteEAVFramework) == 'false'"> | ||
<PackageReference Include="EAVFramework" Version="$(EAVFrameworkVersion)" /> | ||
</ItemGroup> | ||
|
||
|
||
|
||
|
||
<ItemGroup> | ||
<PackageReference Include="IdentityModel" Version="6.2.0" /> | ||
</ItemGroup> | ||
</Project> |
75 changes: 75 additions & 0 deletions
75
src/EAVFW.Extensions.EasyAuth.MicrosoftEntraId/MicrosoftEntraEasyAuthProvider.cs
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,75 @@ | ||
using EAVFramework.Authentication; | ||
using IdentityModel.Client; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Extensions.Options; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Security.Claims; | ||
using System.Threading.Tasks; | ||
using static IdentityModel.OidcConstants; | ||
|
||
namespace EAVFW.Extensions.EasyAuth.MicrosoftEntraId | ||
{ | ||
|
||
public class MicrosoftEntraEasyAuthProvider : IEasyAuthProvider | ||
{ | ||
private readonly IOptions<MicrosoftEntraIdEasyAuthOptions> _options; | ||
|
||
public string AuthenticationName => "MicrosoftEntraId"; | ||
|
||
public HttpMethod CallbackHttpMethod => HttpMethod.Post; | ||
|
||
public bool AutoGenerateRoutes { get; set; } = true; | ||
|
||
public MicrosoftEntraEasyAuthProvider() { } | ||
|
||
public MicrosoftEntraEasyAuthProvider(IOptions<MicrosoftEntraIdEasyAuthOptions> options) | ||
{ | ||
_options = options ?? throw new System.ArgumentNullException(nameof(options)); | ||
} | ||
|
||
public async Task OnAuthenticate(HttpContext httpcontext, string handleId, string redirectUrl) | ||
{ | ||
var email = httpcontext.Request.Query["email"].FirstOrDefault(); | ||
var redirectUri = httpcontext.Request.Query["redirectUri"].FirstOrDefault(); | ||
|
||
// var url =$"{oauthEndpoint}" | ||
var ru = new RequestUrl(_options.Value.AuthorizationUrl); | ||
|
||
//var authUri = ru.CreateAuthorizeUrl(_options.Value.ClientI | ||
// responseType: ResponseTypes.Code, | ||
// redirectUri: _options.Value.RedirectUri, | ||
// responseMode: ResponseModes.FormPost , | ||
|
||
// // extra: new Parameters { { "consentId", provider.ExternalId } }, | ||
// // codeChallenge: challenge, | ||
// // nonce: nonce, | ||
// // responseMode: ResponseModes.FormPost, | ||
// //scope: "payments:inbound payments:outbound accounts offline_access", | ||
|
||
// state: handleId); | ||
|
||
|
||
} | ||
|
||
public Task<(ClaimsPrincipal, string, string)> OnCallback(HttpContext httpcontext) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public RequestDelegate OnSignedOut() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public RequestDelegate OnSignout(string callbackUrl) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public RequestDelegate OnSingleSignOut(string callbackUrl) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/EAVFW.Extensions.EasyAuth.MicrosoftEntraId/MicrosoftEntraIdEasyAuthExtensions.cs
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 @@ | ||
using EAVFramework.Configuration; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace EAVFW.Extensions.EasyAuth.MicrosoftEntraId | ||
{ | ||
public static class MicrosoftEntraIdEasyAuthExtensions | ||
{ | ||
public static AuthenticatedEAVFrameworkBuilder AddMicrosoftEntraIdEasyAuth(this AuthenticatedEAVFrameworkBuilder builder) | ||
{ | ||
|
||
builder.AddAuthenticationProvider<MicrosoftEntraEasyAuthProvider, MicrosoftEntraIdEasyAuthOptions,IConfiguration>((options, config) => | ||
{ | ||
|
||
}); | ||
return builder; | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/EAVFW.Extensions.EasyAuth.MicrosoftEntraId/MicrosoftEntraIdEasyAuthOptions.cs
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,9 @@ | ||
namespace EAVFW.Extensions.EasyAuth.MicrosoftEntraId | ||
{ | ||
public class MicrosoftEntraIdEasyAuthOptions | ||
{ | ||
public string AuthorizationUrl { get; set; } | ||
public string ClientId { get; set; } | ||
public string RedirectUri { get; set; } | ||
} | ||
} |