|
@@ -7,7 +7,8 @@ Two plain-HTTP origins on the host, reachable from a QEMU slirp guest as
|
|
|
chat (default port 18080): /auth/login, /auth/callback, /auth/return,
|
|
chat (default port 18080): /auth/login, /auth/callback, /auth/return,
|
|
|
/auth/logout and the /api/* routes the client uses
|
|
/auth/logout and the /api/* routes the client uses
|
|
|
login (default port 18081): /openid/auth, /openid/interaction/<uid>
|
|
login (default port 18081): /openid/auth, /openid/interaction/<uid>
|
|
|
- (HTML with the cloudron-config JSON), POST .../login and .../confirm
|
|
|
|
|
|
|
+ (login page with cloudron-config JSON, consent page as a bare
|
|
|
|
|
+ auto-submit form), POST .../login and .../confirm
|
|
|
|
|
|
|
|
Accounts (password "test"):
|
|
Accounts (password "test"):
|
|
|
test plain login
|
|
test plain login
|
|
@@ -216,6 +217,25 @@ LOGIN_PAGE = """<!DOCTYPE html>
|
|
|
</head><body><div id="app"></div></body></html>
|
|
</head><body><div id="app"></div></body></html>
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
|
|
+# The real Cloudron consent page (dashboard/oidc_interaction_confirm.html) is
|
|
|
|
|
+# a bare auto-submit form, not the login SPA: no cloudron-config JSON.
|
|
|
|
|
+CONSENT_PAGE = """<!DOCTYPE html>
|
|
|
|
|
+<html lang="en">
|
|
|
|
|
+ <head>
|
|
|
|
|
+ <title>Authorize chat</title>
|
|
|
|
|
+ </head>
|
|
|
|
|
+<body>
|
|
|
|
|
+
|
|
|
|
|
+<form id="submitForm" method="post" action="/openid/interaction/%s/confirm">
|
|
|
|
|
+ <!-- <button type="submit"></button> -->
|
|
|
|
|
+</form>
|
|
|
|
|
+
|
|
|
|
|
+<script type="module" src="/src/oidcinteractionconfirm.js"></script>
|
|
|
|
|
+
|
|
|
|
|
+</body>
|
|
|
|
|
+</html>
|
|
|
|
|
+"""
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class LoginHandler(Base):
|
|
class LoginHandler(Base):
|
|
|
def do_GET(self):
|
|
def do_GET(self):
|
|
@@ -241,12 +261,11 @@ class LoginHandler(Base):
|
|
|
if not it or self.cookies().get("_interaction") != it["icookie"]:
|
|
if not it or self.cookies().get("_interaction") != it["icookie"]:
|
|
|
return self.send(400, {"message": "interaction cookie missing"})
|
|
return self.send(400, {"message": "interaction cookie missing"})
|
|
|
if it["user"] and it["consent"]:
|
|
if it["user"] and it["consent"]:
|
|
|
- cfg = {"name": "chat", "submitUrl": "/openid/interaction/%s/confirm" % uid}
|
|
|
|
|
- else:
|
|
|
|
|
- cfg = {"iconUrl": "/icon", "name": "chat", "note": "",
|
|
|
|
|
- "submitUrl": "/openid/interaction/%s/login" % uid,
|
|
|
|
|
- "passkeyLoginUrl": "/openid/interaction/%s/passkey_login" % uid,
|
|
|
|
|
- "footer": "© mock", "language": None}
|
|
|
|
|
|
|
+ return self.send(200, CONSENT_PAGE % uid, "text/html")
|
|
|
|
|
+ cfg = {"iconUrl": "/icon", "name": "chat", "note": "",
|
|
|
|
|
+ "submitUrl": "/openid/interaction/%s/login" % uid,
|
|
|
|
|
+ "passkeyLoginUrl": "/openid/interaction/%s/passkey_login" % uid,
|
|
|
|
|
+ "footer": "© mock", "language": None}
|
|
|
return self.send(200, LOGIN_PAGE % json.dumps(cfg), "text/html")
|
|
return self.send(200, LOGIN_PAGE % json.dumps(cfg), "text/html")
|
|
|
if len(parts) == 3 and parts[:2] == ["openid", "auth"]:
|
|
if len(parts) == 3 and parts[:2] == ["openid", "auth"]:
|
|
|
uid = parts[2]
|
|
uid = parts[2]
|