Files
portainer-core/test-headers.html
T

63 lines
2.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Header Test</title>
<style>
body { font-family: monospace; padding: 20px; background: #1a1a1a; color: #00ff00; }
h1 { color: #00ff00; }
.header { padding: 5px; margin: 2px 0; background: #2a2a2a; }
.header-name { color: #00aaff; font-weight: bold; }
.header-value { color: #ffff00; }
.good { background: #003300; }
</style>
</head>
<body>
<h1>Authentik Header Test</h1>
<p>This page will request headers from your current session</p>
<div id="results">Loading...</div>
<script>
// Make a request to a simple echo endpoint
fetch('/api/test-headers')
.then(r => r.json())
.then(data => {
const headers = data.headers || {};
let html = '<h2>Received Headers:</h2>';
const authentikHeaders = [
'x-authentik-username',
'x-authentik-email',
'x-authentik-groups',
'x-authentik-name',
'x-authentik-uid'
];
for (let header of authentikHeaders) {
const value = headers[header] || headers[header.toUpperCase()] || '(not found)';
const hasValue = value !== '(not found)';
html += `<div class="header ${hasValue ? 'good' : ''}">`;
html += `<span class="header-name">${header}:</span> `;
html += `<span class="header-value">${value}</span>`;
html += `</div>`;
}
html += '<h2>All Headers:</h2>';
for (let [key, value] of Object.entries(headers)) {
html += `<div class="header">`;
html += `<span class="header-name">${key}:</span> `;
html += `<span class="header-value">${value}</span>`;
html += `</div>`;
}
document.getElementById('results').innerHTML = html;
})
.catch(e => {
document.getElementById('results').innerHTML =
`<p style="color: red;">Error: ${e.message}</p>
<p>Your Organizr installation may not have an API endpoint we can test with.</p>
<p>Please check the Organizr logs or settings to see what headers it's receiving.</p>`;
});
</script>
</body>
</html>