Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: delegate auth in embed mode #10082

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Conversation

LukasHirt
Copy link
Collaborator

Description

Add option to delegate authentication to parent application when Web is included in Embed mode. The automatic token refresh is disabled in such configuration and token is set/updated via events.

Related Issue

Motivation and Context

Do not force the user to authenticate twice when the parent application already has valid access_token.

How Has This Been Tested?

  • test environment: local
  • test case 1: open web in embed mode with delegated authentication and manually post an existing access_token with postMessage method

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

This comment was marked as outdated.

@LukasHirt LukasHirt force-pushed the feat/embed-auth-delegation branch from 430d807 to 4b243dc Compare November 28, 2023 17:30
@LukasHirt LukasHirt added Status:Needs-Review Needs review from a maintainer and removed Status:In-Progress labels Nov 28, 2023
@LukasHirt LukasHirt marked this pull request as ready for review November 28, 2023 17:31
docs/embed-mode/_index.md Outdated Show resolved Hide resolved
docs/embed-mode/_index.md Outdated Show resolved Hide resolved
docs/embed-mode/_index.md Outdated Show resolved Hide resolved
docs/embed-mode/_index.md Outdated Show resolved Hide resolved
docs/embed-mode/_index.md Outdated Show resolved Hide resolved
packages/web-runtime/src/router/setupAuthGuard.ts Outdated Show resolved Hide resolved
packages/web-runtime/src/services/auth/authService.ts Outdated Show resolved Hide resolved
packages/web-runtime/src/services/auth/userManager.ts Outdated Show resolved Hide resolved
packages/web-runtime/src/services/auth/userManager.ts Outdated Show resolved Hide resolved
@LukasHirt LukasHirt force-pushed the feat/embed-auth-delegation branch from 6543ab5 to eb20dbb Compare November 29, 2023 13:56
@LukasHirt LukasHirt requested a review from kulmann November 29, 2023 13:56
Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - we should quickly try this in a deployment. Could you make the few adjustments and merge afterwards? Then I can tag an alpha release in the evening and bring it to the ocis repo.

packages/web-pkg/src/composables/embedMode/useEmbedMode.ts Outdated Show resolved Hide resolved
packages/web-pkg/src/composables/embedMode/useEmbedMode.ts Outdated Show resolved Hide resolved
packages/web-pkg/src/composables/embedMode/useEmbedMode.ts Outdated Show resolved Hide resolved
): RawConfig['options']['embed'] => {
const config: RawConfig['options']['embed'] = {}

if (!doesEmbedEnabledOptionExists) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My feeling is that we don't need the check. But fine either way. 👍

@LukasHirt LukasHirt force-pushed the feat/embed-auth-delegation branch from eb20dbb to 50ab483 Compare November 29, 2023 16:38
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

63.6% 63.6% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@LukasHirt LukasHirt merged commit e408314 into master Nov 29, 2023
3 of 4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feat/embed-auth-delegation branch November 29, 2023 17:25
ownclouders pushed a commit that referenced this pull request Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category:Enhancement Add new functionality Status:Needs-Review Needs review from a maintainer
Projects
None yet
3 participants