Skip to content

Commit

Permalink
Adds authentication support for the extension in playground environments
Browse files Browse the repository at this point in the history
Adds authentication support for the extension in playground environments,
integrating cloud token validation and enabling token retrieval from
callback URLs dispatched by the cloud. Key changes include:

	•	Auth Token Handling: Simplified by removing unused refresh token
    logic, as the access token has an extended lifespan.
	•	Token Validation: A static method now checks tokens against
    playground secrets, using the cloud endpoint for validation.
	•	Callback Integration: Supports token recovery from cloud callback
    URLs, enhancing seamless access when the user is already
    authenticaded in the Cloud.
  • Loading branch information
pastuxso committed Oct 25, 2024
1 parent d2dadcc commit da11bcf
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 77 deletions.
37 changes: 20 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@
"@graphql-codegen/client-preset": "^4.4.0",
"@graphql-codegen/typescript": "4.1.0",
"@octokit/rest": "^19.0.13",
"@types/jsonwebtoken": "^9.0.7",
"@types/node": "^18.19.14",
"@types/node-fetch": "^2.6.11",
"@types/semver": "^7.5.8",
Expand Down Expand Up @@ -1298,6 +1299,7 @@
"got": "^11.8.2",
"graphql": "^16.8.0",
"jsonc-parser": "^3.2.1",
"jsonwebtoken": "^9.0.2",
"lit": "^3.2.1",
"octokit": "^4.0.2",
"simple-git": "^3.27.0",
Expand Down
7 changes: 5 additions & 2 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,11 @@ export class RunmeExtension {
}

if (kernel.isFeatureOn(FeatureName.RequireStatefulAuth)) {
const forceLogin = kernel.isFeatureOn(FeatureName.ForceLogin)
context.subscriptions.push(new StatefulAuthProvider(context, uriHandler))
const statefulAuthProvider = new StatefulAuthProvider(context, uriHandler)
context.subscriptions.push(statefulAuthProvider)

const secrestAuthed = statefulAuthProvider.loadFromSecrets()
const forceLogin = kernel.isFeatureOn(FeatureName.ForceLogin) || (await secrestAuthed)
const silent = forceLogin ? undefined : true

getPlatformAuthSession(forceLogin, silent)
Expand Down
Loading

0 comments on commit da11bcf

Please sign in to comment.