btg-sandbox-markdown-formatter/process.php
DJP 5e4d4d0115 Initial commit: Secure Markdown to HTML converter with Azure AD authentication
- Web-based Markdown formatter with real-time conversion
- Microsoft Azure AD authentication with PKCE flow
- Server-side JWT validation with httpOnly cookies
- Clipboard functionality for HTML/text output
- PHP backend with Composer dependency management
- Comprehensive README with installation instructions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 17:33:35 -04:00

31 lines
No EOL
965 B
PHP
Executable file

<?php
require_once 'config.php';
require_once 'AuthMiddleware.php';
// Require authentication for this endpoint
$auth = new AuthMiddleware();
$user = $auth->requireAuth();
header('Content-Type: application/json');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input = json_decode(file_get_contents('php://input'), true);
$markdown = $input['markdown'] ?? $_POST['markdown'] ?? '';
if (empty($markdown)) {
http_response_code(400);
echo json_encode(['error' => 'No markdown content provided']);
exit;
}
// You can add additional processing or sanitization here if needed
// For now, we're just passing through the markdown (conversion happens client-side)
echo json_encode([
'html' => $markdown,
'processed_by' => $user['name'] ?? $user['preferred_username'] ?? 'Unknown User'
]);
} else {
http_response_code(405);
echo json_encode(['error' => 'Method not allowed']);
}