better data set for demo docker testing

This commit is contained in:
mr
2026-03-06 08:46:11 +01:00
parent 880e3564f1
commit af4893dd76
20 changed files with 298 additions and 52 deletions

View File

@@ -16,7 +16,7 @@
],
"scope": "openid profile email roles",
"redirect_uris": [
"http://localhost:8000"
"http://localhost:8000/l"
],
"token_endpoint_auth_method": "client_secret_post"
}

View File

@@ -77,12 +77,12 @@ services:
LOG_LEAK_SENSITIVE_VALUES: true
# OAUTH2_TOKEN_HOOK_URL: http://oc-auth:8080/oc/claims
HYDRA_ADMIN_URL: http://hydra:4445
URLS_SELF_ISSUER: http://hydra:4444
URLS_SELF_PUBLIC: http://hydra:4444
URLS_LOGIN: http://oc-auth:8080/oc/login
URLS_CONSENT: http://oc-auth:8080/oc/consent
URLS_LOGOUT: http://oc-auth:8080/oc/logout
URLS_ERROR: http://google.com
URLS_SELF_ISSUER: http://localhost:8000/hydra
URLS_SELF_PUBLIC: http://localhost:8000/hydra
URLS_LOGIN: http://localhost:8000/auth/login
URLS_CONSENT: http://localhost:8000/auth/consent
URLS_LOGOUT: http://localhost:8000/auth/logout
URLS_ERROR: http://localhost:8000/l
WEBFINGER_OIDC_DISCOVERY_SUPPORTED_SCOPES: profile,email,phone,roles
WEBFINGER_OIDC_DISCOVERY_SUPPORTED_CLAIMS: name,family_name,given_name,nickname,email,phone_number
DSN: memory
@@ -142,6 +142,22 @@ services:
container_name: keto
networks:
- oc
login-app:
image: nginx:alpine
container_name: login-app
ports:
- "9090:80"
networks:
- oc
volumes:
- ./html:/usr/share/nginx/html:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.login.entrypoints=web"
- "traefik.http.routers.login.rule=PathPrefix(`/l`)"
- "traefik.http.services.login.loadbalancer.server.port=80"
- "traefik.http.middlewares.login-stripprefix.stripprefix.prefixes=/l"
- "traefik.http.routers.login.middlewares=login-stripprefix"
volumes:
oc-data:

View File

@@ -24,3 +24,4 @@ volumes:
networks:
oc:
external: true

View File

@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Login</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f4f6f9;
display: flex;
height: 100vh;
align-items: center;
justify-content: center;
}
.login-container {
background: white;
padding: 40px;
border-radius: 8px;
box-shadow: 0 5px 20px rgba(0,0,0,0.1);
width: 300px;
}
h2 {
text-align: center;
}
input {
width: 100%;
padding: 10px;
margin-top: 10px;
border-radius: 4px;
border: 1px solid #ccc;
}
button {
width: 100%;
margin-top: 20px;
padding: 10px;
background: #007BFF;
border: none;
color: white;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background: #0056b3;
}
.error {
color: red;
margin-top: 10px;
text-align: center;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Connexion</h2>
<form id="loginForm">
<input type="text" id="username" placeholder="Username" required />
<input type="password" id="password" placeholder="Password" required />
<button type="submit">Login</button>
<div class="error" id="error"></div>
</form>
</div>
<script>
function getLoginChallenge() {
const params = new URLSearchParams(window.location.search);
return params.get("login_challenge");
}
document.getElementById("loginForm").addEventListener("submit", async function(event) {
event.preventDefault();
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
const loginChallenge = getLoginChallenge();
if (!loginChallenge) {
document.getElementById("error").innerText = "Missing login_challenge in URL";
return;
}
try {
const response = await fetch("http://localhost:8000/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
login_challenge: loginChallenge,
username: username,
password: password
})
});
if (!response.ok) {
throw new Error("Login failed");
}
const data = await response.json();
console.log("Success:", data);
alert("Login success");
} catch (err) {
document.getElementById("error").innerText = "Login failed";
}
});
</script>
</body>
</html>