UNPKG

spa-entra-id

Version:

Single Page Application with Azure Entra ID authentication using MSAL

330 lines (288 loc) 8.02 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SPA with Entra ID Authentication</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; margin: 0; padding: 0; } body.signed-in { background: #f8f9fa; display: flex; flex-direction: column; } .container { background: white; padding: 2rem; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); text-align: center; max-width: 400px; width: 90%; margin: auto; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .container.full-screen { position: static; transform: none; max-width: none; width: 100%; height: 100vh; margin: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; overflow-y: auto; } .full-screen-header { background: #0078d4; color: white; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .full-screen-header h1 { margin: 0; font-size: 1.5rem; } .full-screen-content { flex: 1; padding: 2rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; max-width: 1200px; margin: 0 auto; width: 100%; } .profile-section { background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); text-align: left; } .token-section { display: flex; flex-direction: column; gap: 1rem; } .token-info { background: #f8f9fa; padding: 1rem; border-radius: 5px; margin: 0; border-left: 4px solid #0078d4; } .token-display { width: 100%; min-height: 200px; padding: 0.5rem; border: 1px solid #ced4da; border-radius: 3px; font-family: 'Courier New', monospace; font-size: 0.8rem; background: white; color: #333; resize: vertical; word-break: break-all; } .actions-section { padding: 1rem 2rem; background: #f8f9fa; border-top: 1px solid #dee2e6; display: flex; gap: 1rem; justify-content: center; } h1 { color: #333; margin-bottom: 1rem; } .user-info { background: #f8f9fa; padding: 1rem; border-radius: 5px; margin: 1rem 0; text-align: left; } .user-info h3 { color: #495057; margin-bottom: 0.5rem; } .user-info p { color: #6c757d; margin: 0.25rem 0; } button { background: #0078d4; color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 5px; cursor: pointer; font-size: 1rem; margin: 0.5rem; transition: background-color 0.3s; } button:hover { background: #106ebe; } button:disabled { background: #ccc; cursor: not-allowed; } .error { color: #dc3545; background: #f8d7da; padding: 0.75rem; border-radius: 5px; margin: 1rem 0; } .loading { color: #6c757d; font-style: italic; } .token-info { background: #f8f9fa; padding: 1rem; border-radius: 5px; margin: 1rem 0; border-left: 4px solid #0078d4; } .token-info h4 { color: #495057; margin: 0 0 0.5rem 0; font-size: 1rem; } .token-claims { background: #fff; padding: 0.75rem; border: 1px solid #dee2e6; border-radius: 3px; margin: 0.5rem 0; font-size: 0.9rem; } .token-claims p { margin: 0.25rem 0; color: #495057; } .token-claims strong { color: #212529; display: inline-block; min-width: 80px; } .token-display { width: 100%; min-height: 120px; padding: 0.5rem; border: 1px solid #ced4da; border-radius: 3px; font-family: 'Courier New', monospace; font-size: 0.8rem; background: white; color: #333; resize: vertical; word-break: break-all; } .token-display:focus { outline: none; border-color: #0078d4; } #copyTokenBtn { background: #28a745; font-size: 0.9rem; padding: 0.5rem 1rem; margin: 0.5rem 0 0 0; } #copyTokenBtn:hover { background: #218838; } .auth-options { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #e9ecef; } .secondary-btn { background: #6c757d; color: white; border: none; padding: 0.5rem 1rem; border-radius: 5px; cursor: pointer; font-size: 0.9rem; transition: background-color 0.3s; } .secondary-btn:hover { background: #5a6268; } .info-text { color: #28a745; font-size: 0.9rem; margin: 0.5rem 0; font-style: italic; } .error-actions { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; } .auth-options small { display: block; color: #6c757d; margin-top: 0.5rem; font-size: 0.8rem; } .warning-text { color: #856404; background-color: #fff3cd; border: 1px solid #ffeaa7; padding: 0.5rem; border-radius: 4px; font-size: 0.9rem; margin: 0.5rem 0; } @media (max-width: 768px) { .full-screen-content { grid-template-columns: 1fr; padding: 1rem; } .full-screen-header { padding: 0.75rem 1rem; } .full-screen-header h1 { font-size: 1.25rem; } } </style> <script type="module" crossorigin src="/assets/main-Dz8qUR3f.js"></script> <link rel="modulepreload" crossorigin href="/assets/config-DsmLiMCp.js"> </head> <body> <div class="container"> <h1>SPA with Entra ID</h1> <div id="content"> <p class="loading">Initializing authentication...</p> </div> </div> </body> </html>