sessions - specific auth branding for auth redirect (#298277)

This commit is contained in:
Benjamin Pasero
2026-02-27 17:22:14 +01:00
committed by GitHub
parent 79d358e5ea
commit 77044e33d8
5 changed files with 43 additions and 8 deletions

View File

@@ -30,9 +30,17 @@
</div>
<script>
const urlParams = new URLSearchParams(window.location.search);
const appName = urlParams.get('app_name');
document.querySelectorAll('.app-name').forEach(e => e.innerText = appName);
if (urlParams.get('app_is_sessions') === 'true') {
const iconImg = document.querySelector('.icon-container img');
if (iconImg) {
iconImg.src = 'sessions-icon.svg';
}
}
// if name contains 'insiders', update filter CSS variables
if (appName.toLowerCase().includes('insiders')) {
document.documentElement.style.setProperty('--vscode-filter-0', 'var(--vscode-insiders-filter-0)');

View File

@@ -0,0 +1,24 @@
<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M64 302.719C64 333.652 80.64 361.599 106.667 376.532L469.333 585.812V930.772C469.333 945.919 461.227 959.999 448 967.679C434.773 975.359 418.56 975.359 405.333 967.679L85.3333 782.932C72.1067 775.252 64 761.172 64 746.025V302.719Z" fill="url(#paint0_linear_608_6009)"/>
<path d="M448 56.3225C461.227 64.0025 469.333 78.0825 469.333 93.2292V585.816L106.667 376.536C80.64 361.603 64 333.656 64 302.723C64 272.216 80.2133 244.056 106.667 228.696L405.333 56.3225C418.56 48.6425 434.773 48.6425 448 56.3225Z" fill="url(#paint1_linear_608_6009)"/>
<path d="M618.667 56.3225L938.667 241.069C951.893 248.749 960 262.829 960 277.976V721.283C960 690.349 943.36 662.403 917.333 647.469L554.667 437.976V93.2292C554.667 78.0825 562.773 64.0025 576 56.3225C589.227 48.6425 605.44 48.6425 618.667 56.3225Z" fill="url(#paint2_linear_608_6009)"/>
<path d="M554.667 437.974L917.333 647.467C943.36 662.401 960 690.347 960 721.281C960 752.214 943.787 779.947 917.333 795.307L618.667 967.681C605.44 975.361 589.227 975.361 576 967.681C562.773 960.001 554.667 945.921 554.667 930.774V437.974Z" fill="url(#paint3_linear_608_6009)"/>
<defs>
<linearGradient id="paint0_linear_608_6009" x1="469.333" y1="586.667" x2="64" y2="586.667" gradientUnits="userSpaceOnUse">
<stop stop-color="#1797D9"/>
<stop offset="1" stop-color="#087CBF"/>
</linearGradient>
<linearGradient id="paint1_linear_608_6009" x1="181.333" y1="405.333" x2="394.667" y2="53.3333" gradientUnits="userSpaceOnUse">
<stop stop-color="#005B9E"/>
<stop offset="1" stop-color="#087CBF"/>
</linearGradient>
<linearGradient id="paint2_linear_608_6009" x1="970.667" y1="166.975" x2="554.667" y2="166.975" gradientUnits="userSpaceOnUse">
<stop offset="0.0211942" stop-color="#26B2F3"/>
<stop offset="1" stop-color="#3AC6FF"/>
</linearGradient>
<linearGradient id="paint3_linear_608_6009" x1="570.2" y1="973.443" x2="810.667" y2="581.333" gradientUnits="userSpaceOnUse">
<stop stop-color="#1EA5E6"/>
<stop offset="1" stop-color="#087CBF"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -19,7 +19,8 @@
],
"enabledApiProposals": [
"authIssuers",
"authProviderSpecific"
"authProviderSpecific",
"agentSessionsWorkspace"
],
"activationEvents": [],
"capabilities": {

View File

@@ -7,7 +7,7 @@ import { URL } from 'url';
import * as fs from 'fs';
import * as path from 'path';
import { randomBytes } from 'crypto';
import { env } from 'vscode';
import { env, workspace } from 'vscode';
function sendFile(res: http.ServerResponse, filepath: string) {
const isSvg = filepath.endsWith('.svg');
@@ -99,13 +99,14 @@ export class LoopbackAuthServer implements ILoopbackServer {
this._resultPromise = new Promise<IOAuthResult>((resolve, reject) => deferred = { resolve, reject });
const appNameQueryParam = `&app_name=${encodeURIComponent(env.appName)}`;
const appIsSessionsQueryParam = workspace.isAgentSessionsWorkspace ? '&app_is_sessions=true' : '';
this._server = http.createServer((req, res) => {
const reqUrl = new URL(req.url!, `http://${req.headers.host}`);
switch (reqUrl.pathname) {
case '/signin': {
const receivedNonce = (reqUrl.searchParams.get('nonce') ?? '').replace(/ /g, '+');
if (receivedNonce !== this.nonce) {
res.writeHead(302, { location: `/?error=${encodeURIComponent('Nonce does not match.')}${appNameQueryParam}` });
res.writeHead(302, { location: `/?error=${encodeURIComponent('Nonce does not match.')}${appNameQueryParam}${appIsSessionsQueryParam}` });
res.end();
}
res.writeHead(302, { location: this._startingRedirect.toString() });
@@ -122,20 +123,20 @@ export class LoopbackAuthServer implements ILoopbackServer {
return;
}
if (this.state !== state) {
res.writeHead(302, { location: `/?error=${encodeURIComponent('State does not match.')}${appNameQueryParam}` });
res.writeHead(302, { location: `/?error=${encodeURIComponent('State does not match.')}${appNameQueryParam}${appIsSessionsQueryParam}` });
res.end();
throw new Error('State does not match.');
}
if (this.nonce !== nonce) {
res.writeHead(302, { location: `/?error=${encodeURIComponent('Nonce does not match.')}${appNameQueryParam}` });
res.writeHead(302, { location: `/?error=${encodeURIComponent('Nonce does not match.')}${appNameQueryParam}${appIsSessionsQueryParam}` });
res.end();
throw new Error('Nonce does not match.');
}
deferred.resolve({ code, state });
if (isPortable) {
res.writeHead(302, { location: `/?app_name=${encodeURIComponent(env.appName)}` });
res.writeHead(302, { location: `/?app_name=${encodeURIComponent(env.appName)}${appIsSessionsQueryParam}` });
} else {
res.writeHead(302, { location: `/?redirect_uri=${encodeURIComponent(callbackUri)}${appNameQueryParam}` });
res.writeHead(302, { location: `/?redirect_uri=${encodeURIComponent(callbackUri)}${appNameQueryParam}${appIsSessionsQueryParam}` });
}
res.end();
break;

View File

@@ -14,6 +14,7 @@
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.authIssuers.d.ts",
"../../src/vscode-dts/vscode.proposed.authProviderSpecific.d.ts"
"../../src/vscode-dts/vscode.proposed.authProviderSpecific.d.ts",
"../../src/vscode-dts/vscode.proposed.agentSessionsWorkspace.d.ts"
]
}