diff --git a/dashboard/proxyauth.html b/dashboard/proxyauth.html
new file mode 100644
index 000000000..41264c395
--- /dev/null
+++ b/dashboard/proxyauth.html
@@ -0,0 +1,21 @@
+
+
+
+ <%= name %> Login
+
+
+
+
+
+
+
+
+
+
diff --git a/dashboard/src/proxyauth.js b/dashboard/src/proxyauth.js
new file mode 100644
index 000000000..0e0f34e62
--- /dev/null
+++ b/dashboard/src/proxyauth.js
@@ -0,0 +1,16 @@
+import { createApp } from 'vue';
+
+import '@fontsource/noto-sans';
+
+import i18n from './i18n.js';
+import ProxyAuthView from './views/ProxyAuthView.vue';
+
+import './style.css';
+
+(async function init() {
+ const app = createApp(ProxyAuthView);
+
+ app.use(await i18n());
+
+ app.mount('#app');
+})();
diff --git a/dashboard/src/views/ProxyAuthView.vue b/dashboard/src/views/ProxyAuthView.vue
new file mode 100644
index 000000000..a0f54f6f4
--- /dev/null
+++ b/dashboard/src/views/ProxyAuthView.vue
@@ -0,0 +1,23 @@
+
+
+
+
+
+ {{ $t('login.loginTo') }}
+
{{ name }}
+
+
+
+
+
diff --git a/dashboard/vite.config.mjs b/dashboard/vite.config.mjs
index 4c31793ae..edbe8b9f6 100644
--- a/dashboard/vite.config.mjs
+++ b/dashboard/vite.config.mjs
@@ -13,6 +13,7 @@ function injectMetaTags() {
resolve('activation.html'),
resolve('filemanager.html'),
resolve('index.html'),
+ resolve('proxyauth.html'),
resolve('oidc_login.html'),
resolve('oidc_error.html'),
resolve('oidc_interaction_confirm.html'),
@@ -65,6 +66,7 @@ export default defineConfig({
authcallback: resolve('authcallback.html'),
filemanager: resolve('filemanager.html'),
index: resolve('index.html'),
+ proxyauth: resolve('proxyauth.html'),
oidc_login: resolve('oidc_login.html'),
oidc_error: resolve('oidc_error.html'),
oidc_interaction_confirm: resolve('oidc_interaction_confirm.html'),
diff --git a/src/proxyauth.js b/src/proxyauth.js
index 078a70b60..2fdcd0132 100644
--- a/src/proxyauth.js
+++ b/src/proxyauth.js
@@ -12,16 +12,23 @@ const apps = require('./apps.js'),
blobs = require('./blobs.js'),
constants = require('./constants.js'),
dashboard = require('./dashboard.js'),
+ branding = require('./branding.js'),
debug = require('debug')('box:proxyAuth'),
+ ejs = require('ejs'),
express = require('express'),
+ fs = require('fs'),
+ path = require('path'),
+ paths = require('./paths.js'),
hat = require('./hat.js'),
http = require('http'),
HttpError = require('@cloudron/connect-lastmile').HttpError,
HttpSuccess = require('@cloudron/connect-lastmile').HttpSuccess,
jwt = require('jsonwebtoken'),
+ marked = require('marked'),
middleware = require('./middleware'),
oidcServer = require('./oidcserver.js'),
safe = require('safetydance'),
+ settings = require('./settings.js'),
users = require('./users.js'),
util = require('util');
@@ -125,6 +132,7 @@ function auth(req, res, next) {
next(new HttpSuccess(200, {}));
}
+const TEMPLATE_PROXYAUTH = fs.readFileSync(path.join(paths.DASHBOARD_DIR, 'proxyauth.html'), 'utf-8');
async function login(req, res, next) {
const appId = req.headers['x-app-id'] || '';
if (!appId) return next(new HttpError(503, 'Nginx misconfiguration'));
@@ -143,7 +151,21 @@ async function login(req, res, next) {
}
const proxyAuthClientId = `${app.id}-proxyauth`;
- res.redirect(302, `https://${dashboardFqdn}/openid/auth?client_id=${proxyAuthClientId}&scope=openid profile email&response_type=code&redirect_uri=https://${app.fqdn}/callback`);
+
+ const data = {
+ loginUrl: `https://${dashboardFqdn}/openid/auth?client_id=${proxyAuthClientId}&scope=openid profile email&response_type=code&redirect_uri=https://${app.fqdn}/callback`,
+ iconUrl: '/api/v1/cloudron/avatar',
+ name: app.label || app.subdomain || app.fqdn,
+ footer: marked.parse(await branding.renderFooter()),
+ language: await settings.get(settings.LANGUAGE_KEY),
+ };
+
+ if (app) {
+ data.name = app.label || app.fqdn;
+ data.iconUrl = app.iconUrl;
+ }
+
+ return res.send(ejs.render(TEMPLATE_PROXYAUTH, data));
}
async function callback(req, res, next) {