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

Added authentication method selection in integration setup #737

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

SagarGi
Copy link
Collaborator

@SagarGi SagarGi commented Nov 8, 2024

Description

This PR introduces the initial implementation for supporting OIDC-based connections to integrate with OpenProject for backend-to-backend requests.

Key updates in this PR include:

  • Adding a UI option for OIDC-based authorization.
  • Enabling automatic connection when OIDC authorization is selected, and the Keycloak configuration (with proper token-exchange setup) is properly set up.
  • Partially hiding the OpenProject UI and displaying an error message for non-OIDC users when OIDC-based configuration is enabled.
  • Also admin is allowed to switch between both oidc and ouath2 based authorization through UI

NOTE: Error handling is not included in this iteration. Scenarios such as incorrect Keycloak setup, invalid tokens, or other issues will be addressed in a subsequent iteration.)

TODO STILL:

  • fix regression for php and vue unit tests due to new changes
  • add new php unit tests
  • add vue UI unit tests(@SagarGi In progress)

Related Issue or Workpackage

Screenshots (if appropriate):

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)
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Updated CHANGELOG.md file

@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch 4 times, most recently from 850ea4c to cc2bfc1 Compare November 15, 2024 10:51
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch 3 times, most recently from 46b9030 to 10c298a Compare November 21, 2024 06:23
Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch 3 times, most recently from 2992a09 to 480a02a Compare November 27, 2024 06:33
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch 5 times, most recently from 9c4179a to fffc877 Compare December 10, 2024 04:52
@SagarGi SagarGi marked this pull request as ready for review December 10, 2024 06:12
@SagarGi SagarGi self-assigned this Dec 10, 2024
Copy link
Collaborator

@individual-it individual-it left a comment

Choose a reason for hiding this comment

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

there are also a lot of long lines, please fix those also

lib/Controller/OpenProjectAPIController.php Outdated Show resolved Hide resolved
lib/Search/OpenProjectSearchProvider.php Outdated Show resolved Hide resolved
lib/Search/OpenProjectSearchProvider.php Outdated Show resolved Hide resolved
lib/Service/OpenProjectAPIService.php Outdated Show resolved Hide resolved
src/components/AdminSettings.vue Outdated Show resolved Hide resolved
src/components/AdminSettings.vue Outdated Show resolved Hide resolved
src/components/AdminSettings.vue Outdated Show resolved Hide resolved
src/components/AdminSettings.vue Show resolved Hide resolved
src/components/AdminSettings.vue Outdated Show resolved Hide resolved
src/components/AdminSettings.vue Outdated Show resolved Hide resolved
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch 4 times, most recently from 93bfc1a to 252aa30 Compare December 11, 2024 09:57
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch from dcd9dcc to f3bbd21 Compare December 12, 2024 04:19
lib/Service/OpenProjectAPIService.php Show resolved Hide resolved
lib/Service/OpenProjectAPIService.php Outdated Show resolved Hide resolved
lib/Settings/Admin.php Outdated Show resolved Hide resolved
lib/Service/OpenProjectAPIService.php Outdated Show resolved Hide resolved
src/components/OAuthConnectButton.vue Outdated Show resolved Hide resolved
Signed-off-by: Sagar <sagargurung1001@gmail.com>
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch 2 times, most recently from 7a7f05e to 5a0c40a Compare December 16, 2024 10:30
Signed-off-by: Sagar <sagargurung1001@gmail.com>
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch from 5a0c40a to 0be3763 Compare December 16, 2024 11:15
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch from 62f7247 to c6bd475 Compare December 17, 2024 09:32
nabim777 and others added 4 commits December 17, 2024 16:04
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch from d933e32 to afb0653 Compare December 18, 2024 03:47
SagarGi and others added 3 commits December 18, 2024 10:59
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch from 8159f4a to 54dfc00 Compare December 18, 2024 09:14
Signed-off-by: Sagar <sagargurung1001@gmail.com>
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch from 54dfc00 to e6f64e5 Compare December 18, 2024 10:10
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Copy link

JS Code Coverage

Coverage after merging feature/ui_oidc_based_authentication into master will be
86.51%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   adminSettings.js0%0%0%0%1, 1, 10–19, 2, 20–25, 3–9
   bootstrap.js0%0%0%0%1, 1–7
   dashboard.js0%0%0%0%1, 1, 10–19, 2, 20–25, 3–9
   fileActions.js0%0%0%0%1, 1, 10–17, 2–9
   personalSettings.js0%0%0%0%1, 1, 10–19, 2, 20–25, 3–9
   projectTab.js0%0%0%0%1, 1, 10–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50–59, 6, 60–66, 7–9
   reference.js0%0%0%0%1, 1, 10–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50–59, 6, 60, 7–9
   utils.js72.15%100%0%74.03%10–14, 17–27, 6–9
src/components
   AdminSettings.vue89.14%86.73%80%89.95%1000–1003, 1006–1007, 1011–1012, 1015–1016, 1020–1021, 1031–1036, 1087–1102, 1105–1120, 1133–1135, 1141–1170, 1179–1182, 1195–1198, 1218–1221, 1334, 1334–1335, 1335–1354, 1413–1415, 1450–1453, 1489–1491, 1511–1514, 1535–1536, 668, 686, 698, 718–719, 769–771, 786, 786–787, 787, 811, 811, 818–822, 825, 828, 861, 861, 861, 861–863, 876, 876, 876–881, 902–906, 937–939, 954, 960–962, 965–967, 976–977, 980–981, 984–986, 998, 998, 998–999
   OAuthConnectButton.vue91.54%75%100%92.98%59–64, 67–71
   PersonalSettings.vue89.19%84.62%88.89%89.84%107–109, 114–115, 125–130, 133–142, 84, 84
src/components/admin
   FieldValue.vue100%100%100%100%
   FormHeading.vue100%100%100%100%
   TermsOfServiceUnsigned.vue100%100%100%100%
   TextInput.vue100%100%100%100%
src/components/icons
   ClippyIcon.vue100%100%100%100%
   OpenProjectIcon.vue100%100%100%100%
src/components/settings
   CheckBox.vue100%100%100%100%
   SettingsTitle.vue96.74%85.71%100%97.53%46–48
src/components/tab
   EmptyContent.vue96.35%80.95%100%98.18%100, 102–103, 92, 97–99
   SearchInput.vue95.27%92.96%94.74%95.73%134–135, 188, 199–204, 263–265, 281–283, 287–292
   WorkPackage.vue86.07%73.17%93.33%87.42%102–111, 124–126, 137–141, 151–153, 171–177, 215, 215–220, 220, 220–231, 76–77
src/filesPlugin
   filesPlugin.js0%0%0%0%1, 1, 10, 100–104, 11–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50–59, 6, 60–69, 7, 70–79, 8, 80–89, 9, 90–99
   filesPluginLessThan28.js0%0%0%0%1, 1, 10–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50–59, 6, 60–69, 7, 70–78, 8–9
src/utils
   workpackageHelper.js93.73%93.10%88.89%94.15%18–22, 49, 49–51, 94–99
src/views
   CreateWorkPackageModal.vue94.38%86.54%91.67%95.55%353–355, 358, 459–462, 467–472, 477–482, 488–491, 494, 510, 510, 550–554, 564–566, 585–587, 617–619, 641–643, 652–656
   Dashboard.vue77.02%75%63.64%78.36%101–107, 114–115, 119–124, 127–129, 133, 137–138, 143, 146, 149–152, 157–159, 200–206, 212–215, 217–227, 256–264, 277–291, 59, 72, 81, 81
   LinkMultipleFilesModal.vue99.13%97.56%100%99.31%153–155
   ProjectsTab.vue94.28%92.45%93.33%94.58%115–118, 124–126, 146, 157–158, 192–202, 250–252

Copy link

PHP Code Coverage

Coverage after merging feature/ui_oidc_based_authentication into master will be
60.29%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
server/apps/integration_openproject/lib
   Capabilities.php0%100%0%0%19, 26–35
   ServerVersionHelper.php0%100%0%0%17–18, 21, 24
server/apps/integration_openproject/lib/AppInfo
   Application.php7.41%100%25%6%102, 104–107, 109, 111, 113, 117–120, 122–133, 135, 138, 142, 146–148, 75–77, 80–84, 86–91, 93–94, 97
server/apps/integration_openproject/lib/BackgroundJob
   RemoveExpiredDirectUploadTokens.php0%100%0%0%42, 44–46, 55–56
server/apps/integration_openproject/lib/Controller
   ConfigController.php69.96%100%55.56%70.55%136, 177–178, 180, 182–184, 186–189, 192–193, 195, 240, 250, 254–256, 355–359, 484–486, 488–490, 539, 627–630, 632–633, 636, 644–648, 659, 673–676, 684, 688–691, 705–709, 711–712, 714–730, 747–752, 754–755, 757–759, 762, 764–780, 793–800, 802–805, 807–811, 820–825
   DirectDownloadController.php0%100%0%0%37–39, 54–56, 58–65
   DirectUploadController.php70.83%100%100%70%141–143, 186–188, 199, 203–206, 208, 218, 225, 241–243, 245–246, 249–254, 257, 259, 267–269, 275–277, 285–287, 302–304, 323, 328, 334
   FilesController.php72.95%100%83.33%72.41%182–183, 245, 250–253, 255, 257–270, 273–274, 276–277, 281–284, 287, 293
   OpenProjectAPIController.php88.24%100%80.95%88.67%120, 161, 201, 249–251, 254–261, 263–267, 269, 288, 313, 380, 431, 452, 500, 526–528, 531–535, 537, 742–746
server/apps/integration_openproject/lib/Dashboard
   OpenProjectWidget.php0%100%0%0%103, 110, 117, 124–131, 133–137, 141–142, 145–156, 77–82, 89, 96
server/apps/integration_openproject/lib/Exception
   OpenprojectAvatarErrorException.php100%100%100%100%
   OpenprojectErrorException.php100%100%100%100%
   OpenprojectFileNotUploadedException.php100%100%100%100%
   OpenprojectGroupfolderSetupConflictException.php100%100%100%100%
   OpenprojectResponseException.php100%100%100%100%
   OpenprojectUnauthorizedUserException.php0%100%0%0%16
server/apps/integration_openproject/lib/Listener
   BeforeGroupDeletedListener.php0%100%0%0%48, 56–57, 60–63, 65
   BeforeNodeInsideOpenProjectGroupfilderChangedListener.php0%100%0%0%41–43, 47–50, 52, 54, 57–58, 60, 62–65, 67–70, 72–74
   BeforeUserDeletedListener.php0%100%0%0%48, 55–56, 58–61, 63
   LoadAdditionalScriptsListener.php0%100%0%0%32–33, 41–42, 44, 46–47, 49–51, 53
   LoadSidebarScript.php0%100%0%0%100–105, 114–115, 117, 119–120, 122–123, 125, 127–128, 130, 132, 134–141, 145, 148–153, 87–99
   OpenProjectReferenceListener.php0%100%0%0%59–61, 68–69, 71, 73–74, 76–88
   TermsOfServiceEventListener.php0%100%0%0%59–60, 65–66, 68–69, 71–73, 76–80
   UserChangedListener.php0%100%0%0%52, 59–60, 63–68, 71
server/apps/integration_openproject/lib/Migration
   Version2001Date20221213083550.php0%100%0%0%47, 57–65, 67–75, 77–79, 81
   Version2310Date20230116153411.php0%100%0%0%46, 49–52, 54–79, 81–82, 84
   Version2400Date20230504144300.php0%100%0%0%47, 57–60
   Version2640Date20240628114301.php0%100%0%0%52, 64–66, 69–70, 73
server/apps/integration_openproject/lib/Reference
   WorkPackageReferenceProvider.php51.67%100%25%58.33%102, 108–111, 114–116, 119, 123, 157, 165–166, 174, 52, 59, 66, 73–75
server/apps/integration_openproject/lib/Search
   OpenProjectSearchProvider.php0%100%0%0%103–104, 107–111, 113–117, 119–122, 124–127, 131–132, 134–135, 138–147, 149–153, 66–69, 76, 83, 91, 93, 96
   OpenProjectSearchResultEntry.php100%100%100%100%
server/apps/integration_openproject/lib/Service
   DatabaseService.php42.31%100%60%40.43%100–102, 125–129, 131, 80–93, 95–99
   DirectDownloadService.php88.46%100%100%87.50%66–67, 69
   DirectUploadService.php42.86%100%66.67%40%112, 118, 79–82, 84–92
   OauthService.php32.08%100%40%31.25%104–112, 123–130, 79–87, 89–95
   OpenProjectAPIService.php72.58%100%72.13%72.62%1018–1024, 1026–1033, 1035–1042, 1090–1092, 1094–1096, 1099–1103, 1105–1107, 1116–1119, 1122–1124, 1126, 1129–1134, 1138–1139, 1170–1173, 1192–1199, 1215–1216, 1223–1225, 1227–1230, 1234, 1243, 1261, 1263–1266, 1268–1273, 1393, 1419, 1431, 1434, 1456,

Signed-off-by: Sagar <sagargurung1001@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Signed-off-by: Sagar <sagargurung1001@gmail.com>
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch from 8417e71 to 7b4c74e Compare December 24, 2024 05:06
Signed-off-by: Sagar <sagargurung1001@gmail.com>
@SagarGi SagarGi force-pushed the feature/ui_oidc_based_authentication branch from 7b4c74e to 39c9ef4 Compare December 24, 2024 05:55
Signed-off-by: Sagar <sagargurung1001@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants