Add Microsoft Entra ID authentication with OAuth2

This commit is contained in:
nmemmert committed 2025-11-06 09:41:00 -05:00
1 parent 5df055a4da
commit 7ae29b3fbc
3 files changed
+91 -7

No files matched your search

+36 -5
View File
@@ -16,6 +16,33 @@ A Python web application built with Flask that automatically renames PDF files b
- Python 3.6 or higher
- Virtual environment (recommended)
- Microsoft Entra ID (Azure AD) tenant with app registration
## Microsoft Entra ID Setup
1. **Register an application** in Azure Portal:
- Go to Azure Active Directory > App registrations > New registration
- Name: PDF Renamer App
- Supported account types: Accounts in this organizational directory only
- Redirect URI: `http://localhost:3000/auth` (for local development)
2. **Configure authentication**:
- In the app registration, go to Authentication
- Add redirect URI if not set: `http://localhost:3000/auth`
- Enable "Access tokens" and "ID tokens" if needed
3. **Get credentials**:
- Client ID: From Overview page
- Tenant ID: From Overview page
- Client Secret: Go to Certificates & secrets > New client secret
4. **Set environment variables**:
```bash
export TENANT_ID="your-tenant-id"
export CLIENT_ID="your-client-id"
export CLIENT_SECRET="your-client-secret"
export SECRET_KEY="your-random-secret-key"
```
## Installation
@@ -41,19 +68,23 @@ A Python web application built with Flask that automatically renames PDF files b
## Usage
1. **Run the application**:
1. **Set environment variables** (see Entra ID Setup above)
2. **Run the application**:
```bash
python pdf_renamer.py
```
2. **Access the web interface**:
Open your browser to `http://127.0.0.1:3000/`
3. **Access the web interface**:
- Open `http://127.0.0.1:3000/`
- You'll be redirected to Microsoft login
- After authentication, you'll access the app
3. **Upload files**:
4. **Upload files**:
- Select individual PDF files or ZIP archives containing PDFs
- Click "Process PDFs"
4. **Download results**:
5. **Download results**:
- Download the `renamed_files.zip` containing all processed PDFs
- Review any skipped files listed on the results page