opencode-codebuddy-external-auth 1.0.20 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/plugin.js +3 -0
  2. package/package.json +1 -1
package/dist/plugin.js CHANGED
@@ -205,6 +205,8 @@ function pickFallbackModel(models) {
205
205
  return models[0] || "";
206
206
  }
207
207
  async function buildAuthHeaders(accessToken) {
208
+ const payload = decodeJwtPayload(accessToken);
209
+ const roles = payload?.realm_access?.roles || payload?.resource_access?.account?.roles;
208
210
  const tenantId = cachedTenantId || resolveTenantId(accessToken);
209
211
  let enterpriseId = cachedEnterpriseId || resolveEnterpriseId(accessToken);
210
212
  const userId = cachedUserId || resolveUserId(accessToken);
@@ -224,6 +226,7 @@ async function buildAuthHeaders(accessToken) {
224
226
  if (!warnedIdSummary) {
225
227
  warnedIdSummary = true;
226
228
  console.log(`[codebuddy-external] IDs: tenant=${tenantId ? "ok" : "empty"}, enterprise=${enterpriseId ? "ok" : "empty"}, user=${userId ? "ok" : "empty"}`);
229
+ console.log(`[codebuddy-external] Token payload: iss=${payload?.iss ? "ok" : "empty"}, sub=${payload?.sub ? "ok" : "empty"}, roles=${Array.isArray(roles) ? roles.length : 0}`);
227
230
  }
228
231
  if (!tenantId && !warnedTenantId) {
229
232
  warnedTenantId = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codebuddy-external-auth",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "OpenCode plugin for CodeBuddy External (IOA) authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",