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(server): add OIDC for AFFiNE #6991

Merged
merged 21 commits into from
May 23, 2024
Merged

Conversation

IamTaoChen
Copy link
Contributor

@IamTaoChen IamTaoChen commented May 20, 2024

How-to-Use

  OIDC_ISSUER=
  OIDC_CLIENT_ID=
  OIDC_CLIENT_SECRET=
  OIDC_SCOPE=openid email profile
  OIDC_CLAIM_MAP_ID=preferred_username
  OIDC_CLAIM_MAP_EMAIL=email

TO-DO:

  • Add OIDC icon at packages/frontend/core/src/components/affine/auth/oauth.tsx

Bug:(solved)

I can get the userinfo by OIDC plugin but there is an error I don't know how to deal with

http://localhost:8080/signIn?redirect_uri=%2Fworkspace%2FJDJv6ZMiwVlrCOZMyqPda%2Fall&error=%0AInvalid+%60prisma.user.create%28%29%60+invocation%3A%0A%0A%0AAn+operation+failed+because+it+depends+on+one+or+more+records+that+were+required+but+not+found.+No+%27Features%27+record%28s%29+%28needed+to+inline+the+relation+on+%27UserFeatures%27+record%28s%29%29+was+found+for+a+nested+connect+on+one-to-many+relation+%27FeaturesToUserFeatures%27.

-->

http://localhost:8080/signIn?redirect_uri=/workspace/JDJv6ZMiwVlrCOZMyqPda/all&error=
Invalid `prisma.user.create()` invocation:

An operation failed because it depends on one or more records that were required but not found. No 'Features' record(s) (needed to inline the relation on 'UserFeatures' record(s)) was found for a nested connect on one-to-many relation 'FeaturesToUserFeatures'.

@CLAassistant
Copy link

CLAassistant commented May 20, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

graphite-app bot commented May 20, 2024

Your org has enabled the Graphite merge queue for merging into canary

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Member

you may run yarn workspace @affine/server data-migration run before testing

@IamTaoChen
Copy link
Contributor Author

yarn workspace @affine/server data-migration run

yeah, now it works.

Copy link

codecov bot commented May 21, 2024

Codecov Report

Attention: Patch coverage is 47.25275% with 144 lines in your changes are missing coverage. Please review.

Project coverage is 67.24%. Comparing base (0c42849) to head (cfb49d9).

Files Patch % Lines
...backend/server/src/plugins/oauth/providers/oidc.ts 37.55% 133 Missing ⚠️
...ges/backend/server/src/fundamentals/helpers/url.ts 15.38% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           canary    #6991      +/-   ##
==========================================
- Coverage   67.37%   67.24%   -0.13%     
==========================================
  Files         584      585       +1     
  Lines       28463    28732     +269     
  Branches     2591     2594       +3     
==========================================
+ Hits        19177    19321     +144     
- Misses       9015     9140     +125     
  Partials      271      271              
Flag Coverage Δ
server-test 77.83% <47.25%> (-0.32%) ⬇️
unittest 39.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Brooooooklyn Brooooooklyn changed the title add OIDC for AFFiNE feat(server): add OIDC for AFFiNE May 21, 2024
@darkskygit darkskygit merged commit 22a8a26 into toeverything:canary May 23, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

5 participants