Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export function TokenTester() {
response_type: 'code',
client_id: 'simplemodule-client',
redirect_uri: `${window.location.origin}/oauth-callback`,
scope: 'openid profile email',
scope: 'openid profile email roles',
state,
code_challenge: challenge,
code_challenge_method: 'S256',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class Routes
public const string ClientsCreate = "/clients/create";
public const string ClientsEdit = "/clients/{id}/edit";

// View route — registered via ConfigureEndpoints (escape hatch)
// OAuth callback (registered as a top-level IEndpoint, not under ViewPrefix)
public const string OAuthCallback = "/oauth-callback";

// Connect routes (also in ConnectRouteConstants)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using SimpleModule.Core;
using SimpleModule.Core.Inertia;
using SimpleModule.OpenIddict.Contracts;

namespace SimpleModule.OpenIddict.Endpoints.Connect;

[AllowAnonymous]
public class OAuthCallbackEndpoint : IEndpoint
{
public const string Route = OpenIddictModuleConstants.Routes.OAuthCallback;

public void Map(IEndpointRouteBuilder app) =>
app.MapGet(Route, () => Inertia.Render("OpenIddict/OAuthCallback"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void Configure(SwaggerGenOptions options)
{ AuthConstants.OpenIdScope, "OpenID" },
{ AuthConstants.ProfileScope, "Profile" },
{ AuthConstants.EmailScope, "Email" },
{ AuthConstants.RolesScope, "Roles" },
},
},
},
Expand All @@ -55,6 +56,7 @@ public void Configure(SwaggerGenOptions options)
AuthConstants.OpenIdScope,
AuthConstants.ProfileScope,
AuthConstants.EmailScope,
AuthConstants.RolesScope,
]
},
};
Expand Down
10 changes: 0 additions & 10 deletions modules/OpenIddict/src/SimpleModule.OpenIddict/OpenIddictModule.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using SimpleModule.Core;
using SimpleModule.Core.Authorization;
using SimpleModule.Core.Hosting;
using SimpleModule.Core.Inertia;
using SimpleModule.Database;
using SimpleModule.OpenIddict.Contracts;
using SimpleModule.OpenIddict.Hosting;
Expand Down Expand Up @@ -118,12 +115,5 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config
OpenIddictAuthSetup.AddSmartAuthentication(services);
}

public void ConfigureEndpoints(IEndpointRouteBuilder endpoints)
{
endpoints
.MapGet("/oauth-callback", () => Inertia.Render("OpenIddict/OAuthCallback"))
.AllowAnonymous();
}

// Menu items removed — accessible via Admin hub page
}
1 change: 1 addition & 0 deletions packages/SimpleModule.Client/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export const routes = {
api: {
authorization: () => '/connect/authorize' as const,
logout: () => '/connect/endsession' as const,
oAuthCallback: () => '/oauth-callback' as const,
token: () => '/connect/token' as const,
userinfo: () => '/connect/userinfo' as const,
},
Expand Down
Loading