mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-11 02:50:29 +00:00
✨ Add OAuth functionality, MCP tools, and feature tests
- 🔒 Added migrations for `oauth_access_tokens`, `oauth_refresh_tokens`, `oauth_auth_codes`, `oauth_clients`, and `oauth_device_codes`. - 🤖 Created MCP tools (Meetups, Cities, Venues, Courses, Lecturers) for managing entities with authentication and validation. - 🛠️ Implemented Passport-backed OAuth API guard configuration and validation endpoints. - ✅ Added comprehensive feature tests for MCP tools and OAuth functionality (access control, validation, and token-based authentication).
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Erzwingt PKCE mit S256 auf dem OAuth-Authorize-Endpunkt.
|
||||
*
|
||||
* Die Discovery-Metadaten bewerben ausschließlich S256, der zugrunde liegende
|
||||
* league/oauth2-server akzeptiert standardmäßig aber auch das schwächere "plain".
|
||||
* Diese Middleware lehnt jede Authorize-Anfrage mit einer anderen Methode als S256 ab,
|
||||
* sodass das tatsächliche Verhalten der beworbenen Metadaten entspricht (OAuth 2.1).
|
||||
*/
|
||||
class EnforcePkceS256
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if ($request->is('oauth/authorize')
|
||||
&& $request->filled('code_challenge')
|
||||
&& $request->input('code_challenge_method', 'plain') !== 'S256') {
|
||||
abort(Response::HTTP_BAD_REQUEST, 'Es wird ausschließlich die PKCE-Methode "S256" unterstützt.');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user