Skip to content

Commit

Permalink
adding alternative root tenant authority configruation via envvars (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobby Johnson authored Sep 19, 2022
1 parent 74a750f commit 4eb2bcc
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
## [1.3.5] - 2022-08-11

### Changed
- Updated dependencies
- Updated dependencies

## [1.3.6] - 2022-09-19

### Added
- Ability to provide alternative root tenant authority via envvars
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Complete commands:
git clone https://github.com/auth0-training/labs-vscode-extension.git
cd labs-vscode-extension
npm install
vsce package
npm run build:production
npm run package
code --install-extension release.vsix
```

Expand All @@ -49,7 +50,12 @@ Under the Debug Tab in Visual Studio Code, select `Run Extension`.

## Features
---
## Alternative Root Tenant Authority
If you are attempting to work on labs for Layer0 based cloud environments, you can tell the extension to use an alternate root tnenant by passing the following environment variables.

- **VSCODE_EXTENSION_ISSUER** - Default:`https://auth0.auth0.com` The root tenant authority to use.
- **AUTH0_VSCODE_EXTENSION_CLIENT_ID** - Default: `w94YV1qvYFMH2PnmFSIQVxkGJwk0tBGt` The client id that was created specifically for the extension with the altenrative root tenant authority.
- **AUTH0_VSCODE_EXTENSION_AUDIENCE** - Default: `https://*.auth0.com/api/v2/` The Management API audience specific to your environment. **Note:** The wild card tenant segment is required. This enables the RTA to prompt the user for a specific tenant to authorize.
### Contributed Commands
In addition to the visual features listed below, the Labs extension also contributes the following commands to the command palette:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-labs",
"preview": true,
"displayName": "Auth0 Labs",
"version": "1.3.5",
"version": "1.3.6",
"description": "A Visual Studio Code extension for training lab automation and quick access to tenant information.",
"main": "./dist/extension.js",
"publisher": "auth0",
Expand Down
26 changes: 21 additions & 5 deletions src/auth.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
/* eslint-disable @typescript-eslint/naming-convention */
const issuer =
process.env.AUTH0_VSCODE_EXTENSION_ISSUER || 'https://auth0.auth0.com';
const client_id =
process.env.AUTH0_VSCODE_EXTENSION_CLIENT_ID ||
'w94YV1qvYFMH2PnmFSIQVxkGJwk0tBGt';
const audience =
process.env.AUTH0_VSCODE_EXTENSION_AUDIENCE || 'https://*.auth0.com/api/v2/';
const scope =
'openid offline_access read:client_grants delete:client_grants create:client_grants update:client_grants read:clients update:clients delete:clients create:clients read:client_keys update:client_keys delete:client_keys create:client_keys read:connections update:connections delete:connections create:connections read:resource_servers update:resource_servers delete:resource_servers create:resource_servers read:rules update:rules delete:rules create:rules read:hooks update:hooks delete:hooks create:hooks read:rules_configs update:rules_configs delete:rules_configs read:actions update:actions delete:actions read:email_provider update:email_provider delete:email_provider create:email_provider read:tenant_settings update:tenant_settings read:grants delete:grants read:guardian_factors update:guardian_factors read:mfa_policies update:mfa_policies read:email_templates create:email_templates update:email_templates read:roles update:roles delete:roles create:roles read:prompts update:prompts read:branding update:branding read:organizations update:organizations';

export enum OIDC_CONFIG {
ISSUER = 'https://auth0.auth0.com',
CLIENT_ID = 'w94YV1qvYFMH2PnmFSIQVxkGJwk0tBGt',
AUDIENCE = 'https://*.auth0.com/api/v2/',
SCOPE = 'openid offline_access read:client_grants delete:client_grants create:client_grants update:client_grants read:clients update:clients delete:clients create:clients read:client_keys update:client_keys delete:client_keys create:client_keys read:connections update:connections delete:connections create:connections read:resource_servers update:resource_servers delete:resource_servers create:resource_servers read:rules update:rules delete:rules create:rules read:hooks update:hooks delete:hooks create:hooks read:rules_configs update:rules_configs delete:rules_configs read:actions update:actions delete:actions read:email_provider update:email_provider delete:email_provider create:email_provider read:tenant_settings update:tenant_settings read:grants delete:grants read:guardian_factors update:guardian_factors read:mfa_policies update:mfa_policies read:email_templates create:email_templates update:email_templates read:roles update:roles delete:roles create:roles read:prompts update:prompts read:branding update:branding read:organizations update:organizations',
interface I_OIDC_CONFIG {
ISSUER: string;
CLIENT_ID: string;
AUDIENCE: string;
SCOPE: string;
}

export const OIDC_CONFIG: I_OIDC_CONFIG = {
ISSUER: issuer,
CLIENT_ID: client_id,
AUDIENCE: audience,
SCOPE: scope,
};

0 comments on commit 4eb2bcc

Please sign in to comment.