Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added avalonia sample app and detailed description #2199

Draft
wants to merge 1 commit into
base: rel/5.8.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,20 @@
<PackageVersion Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.70" />
<PackageVersion Include="Quartz.Extensions.Hosting" Version="3.5.0" />
<PackageVersion Include="Spectre.Console" Version="0.48.0" />



<PackageVersion Include="Avalonia" Version="11.1.3" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.1.3" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.1.3" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.1.3" />
<PackageVersion Include="Avalonia.Desktop" Version="11.1.3" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.1.3" />
<PackageVersion Include="Avalonia.Browser" Version="11.1.3" />
<PackageVersion Include="Avalonia.Android" Version="11.1.3" />
<PackageVersion Include="Avalonia.iOS" Version="11.1.3" />

<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1" />

<!--
Note: OpenIddict uses PolySharp to dynamically generate polyfills for types that are not available on
some of the targeted TFMs (e.g Index, Range or nullable attributes on .NET Framework/.NET Standard).
Expand Down
38 changes: 38 additions & 0 deletions OpenIddict.sln
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.Console.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.Maui.Client", "sandbox\OpenIddict.Sandbox.Maui.Client\OpenIddict.Sandbox.Maui.Client.csproj", "{CD5EE836-ED56-48E3-B3B6-8D74C7C859B9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Avalonia", "Avalonia", "{77F24A0C-50D9-47DB-92AA-15B514C55DFE}"
ProjectSection(SolutionItems) = preProject
sandbox\OpenIddict.Sandbox.Avalonia.Client\readme.md = sandbox\OpenIddict.Sandbox.Avalonia.Client\readme.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.Avalonia.Client", "sandbox\OpenIddict.Sandbox.Avalonia.Client\OpenIddict.Sandbox.Avalonia.Client\OpenIddict.Sandbox.Avalonia.Client.csproj", "{83F9656B-A339-4CBA-B1CF-392719217B7E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.Avalonia.Client.Android", "sandbox\OpenIddict.Sandbox.Avalonia.Client\OpenIddict.Sandbox.Avalonia.Client.Android\OpenIddict.Sandbox.Avalonia.Client.Android.csproj", "{6AD6AFE9-0971-48A8-84CE-9BEF8022593C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.Avalonia.Client.Desktop", "sandbox\OpenIddict.Sandbox.Avalonia.Client\OpenIddict.Sandbox.Avalonia.Client.Desktop\OpenIddict.Sandbox.Avalonia.Client.Desktop.csproj", "{F216E0E6-7BFE-4C98-9C72-D5E3AE965C67}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenIddict.Sandbox.Avalonia.Client.iOS", "sandbox\OpenIddict.Sandbox.Avalonia.Client\OpenIddict.Sandbox.Avalonia.Client.iOS\OpenIddict.Sandbox.Avalonia.Client.iOS.csproj", "{F24FA764-0AF6-4DE2-A88E-77A1A2D42483}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -393,6 +406,26 @@ Global
{CD5EE836-ED56-48E3-B3B6-8D74C7C859B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD5EE836-ED56-48E3-B3B6-8D74C7C859B9}.Release|Any CPU.Build.0 = Release|Any CPU
{CD5EE836-ED56-48E3-B3B6-8D74C7C859B9}.Release|Any CPU.Deploy.0 = Release|Any CPU
{83F9656B-A339-4CBA-B1CF-392719217B7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83F9656B-A339-4CBA-B1CF-392719217B7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83F9656B-A339-4CBA-B1CF-392719217B7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83F9656B-A339-4CBA-B1CF-392719217B7E}.Release|Any CPU.Build.0 = Release|Any CPU
{6AD6AFE9-0971-48A8-84CE-9BEF8022593C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6AD6AFE9-0971-48A8-84CE-9BEF8022593C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AD6AFE9-0971-48A8-84CE-9BEF8022593C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{6AD6AFE9-0971-48A8-84CE-9BEF8022593C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AD6AFE9-0971-48A8-84CE-9BEF8022593C}.Release|Any CPU.Build.0 = Release|Any CPU
{6AD6AFE9-0971-48A8-84CE-9BEF8022593C}.Release|Any CPU.Deploy.0 = Release|Any CPU
{F216E0E6-7BFE-4C98-9C72-D5E3AE965C67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F216E0E6-7BFE-4C98-9C72-D5E3AE965C67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F216E0E6-7BFE-4C98-9C72-D5E3AE965C67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F216E0E6-7BFE-4C98-9C72-D5E3AE965C67}.Release|Any CPU.Build.0 = Release|Any CPU
{F24FA764-0AF6-4DE2-A88E-77A1A2D42483}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F24FA764-0AF6-4DE2-A88E-77A1A2D42483}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F24FA764-0AF6-4DE2-A88E-77A1A2D42483}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{F24FA764-0AF6-4DE2-A88E-77A1A2D42483}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F24FA764-0AF6-4DE2-A88E-77A1A2D42483}.Release|Any CPU.Build.0 = Release|Any CPU
{F24FA764-0AF6-4DE2-A88E-77A1A2D42483}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -454,6 +487,11 @@ Global
{35997586-8AAB-4EE5-A022-3E5BD12746CE} = {F47D1283-0EE9-4728-8026-58405C29B786}
{819CD7AA-01FD-4369-BABF-5DFCB7E94068} = {F47D1283-0EE9-4728-8026-58405C29B786}
{CD5EE836-ED56-48E3-B3B6-8D74C7C859B9} = {F47D1283-0EE9-4728-8026-58405C29B786}
{77F24A0C-50D9-47DB-92AA-15B514C55DFE} = {F47D1283-0EE9-4728-8026-58405C29B786}
{83F9656B-A339-4CBA-B1CF-392719217B7E} = {77F24A0C-50D9-47DB-92AA-15B514C55DFE}
{6AD6AFE9-0971-48A8-84CE-9BEF8022593C} = {77F24A0C-50D9-47DB-92AA-15B514C55DFE}
{F216E0E6-7BFE-4C98-9C72-D5E3AE965C67} = {77F24A0C-50D9-47DB-92AA-15B514C55DFE}
{F24FA764-0AF6-4DE2-A88E-77A1A2D42483} = {77F24A0C-50D9-47DB-92AA-15B514C55DFE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A710059F-0466-4D48-9B3A-0EF4F840B616}
Expand Down
7 changes: 6 additions & 1 deletion sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using OpenIddict.Sandbox.AspNetCore.Server.Models;
using OpenIddict.Sandbox.AspNetCore.Server.Services;
using Quartz;
using System.Security.Cryptography;
using static OpenIddict.Abstractions.OpenIddictConstants;

namespace OpenIddict.Sandbox.AspNetCore.Server;
Expand Down Expand Up @@ -100,6 +102,9 @@ public void ConfigureServices(IServiceCollection services)
// Register the OpenIddict server components.
.AddServer(options =>
{
// Set Issuer URL
//options.SetIssuer(new Uri("https://vsr1d2md-44395.euw.devtunnels.ms/"));

// Enable the authorization, device, introspection, logout,
// token, revocation, userinfo and verification endpoints.
options.SetAuthorizationEndpointUris("connect/authorize")
Expand Down Expand Up @@ -242,4 +247,4 @@ public void Configure(IApplicationBuilder app)
app.UseMvcWithDefaultRoute();
#endif
}
}
}
41 changes: 41 additions & 0 deletions sandbox/OpenIddict.Sandbox.AspNetCore.Server/Worker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,47 @@ await manager.CreateAsync(new OpenIddictApplicationDescriptor
}
});
}

if (await manager.FindByClientIdAsync("avalonia") is null)
{
await manager.CreateAsync(new OpenIddictApplicationDescriptor
{
ApplicationType = ApplicationTypes.Native,
ClientId = "avalonia",
ClientType = ClientTypes.Public,
ConsentType = ConsentTypes.Systematic,
DisplayName = "Avalonia client application",
DisplayNames =
{
[CultureInfo.GetCultureInfo("fr-FR")] = "Application cliente avalonia"
},
PostLogoutRedirectUris =
{
new Uri("com.openiddict.sandbox.avalonia.client:/callback/logout/local")
},
RedirectUris =
{
new Uri("com.openiddict.sandbox.avalonia.client:/callback/login/local")
},
Permissions =
{
Permissions.Endpoints.Authorization,
Permissions.Endpoints.Logout,
Permissions.Endpoints.Token,
Permissions.GrantTypes.AuthorizationCode,
Permissions.GrantTypes.RefreshToken,
Permissions.ResponseTypes.Code,
Permissions.Scopes.Email,
Permissions.Scopes.Profile,
Permissions.Scopes.Roles,
Permissions.Prefixes.Scope + "demo_api"
},
Requirements =
{
Requirements.Features.ProofKeyForCodeExchange
}
});
}

if (await manager.FindByClientIdAsync("mvc") is null)
{
Expand Down
Loading