Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
clinically-au committed Apr 16, 2024
1 parent a73445b commit 69a0754
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Clinically.Kinde.Authentication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/clinically-au/kinde-authentication</PackageProjectUrl>
<AssemblyName>Clinically.Kinde.Authentication</AssemblyName>
<Version>1.2.2</Version>
<Version>1.2.3</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RootNamespace>Clinically.Kinde.Authentication</RootNamespace>
<PackageId>Clinically.Kinde.Authentication</PackageId>
Expand Down
16 changes: 9 additions & 7 deletions Identity/KindeIdentityEndpointRouteBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ public static IEndpointConventionBuilder MapKindeIdentityEndpoints(this IEndpoin
accountGroup.MapGet("/LoginCallback",
new Func<HttpContext, SignInManager<KindeUser>, string?, string?, Task<RedirectHttpResult>>(async (context,
[FromServices] signInManager,
[FromQuery] ReturnUrl,
[FromQuery] RemoteError) =>
[FromQuery] returnUrl,
[FromQuery] remoteError) =>
{
if (RemoteError is not null)
ArgumentException.ThrowIfNullOrEmpty(returnUrl);

if (remoteError is not null)
{
return TypedResults.Redirect("/Error");
}
Expand All @@ -64,7 +66,7 @@ await signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKe
return TypedResults.Redirect("/Error");
}

return TypedResults.Redirect(ReturnUrl);
return TypedResults.Redirect(returnUrl);
}));

accountGroup.MapPost("/Logout", async (
Expand All @@ -74,9 +76,9 @@ await signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKe
[FromForm] string returnUrl) =>
{
await signInManager.SignOutAsync();
var authority = config.GetRequiredSection("Kinde:Authority").Value;
var baseUrl = config.GetRequiredSection("AppConfig:BaseUrl").Value ?? string.Empty;
var logoutUri = $"{authority}/logout?redirect={Uri.EscapeDataString(baseUrl)}";
var authority = config.GetRequiredSection("Kinde:Domain").Value;
var baseUrl = config.GetRequiredSection("AppConfig:BaseUrl").Value;
var logoutUri = $"{authority}/logout?redirect={Uri.EscapeDataString(baseUrl!)}";
return TypedResults.Redirect(logoutUri);
});

Expand Down

0 comments on commit 69a0754

Please sign in to comment.