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

Convert GitLab login to Socialite #1828

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Http/Controllers/OAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function callback(string $service): RedirectResponse|Redirector
Log::error("Error registering new user via $service: $email");
abort(500, "Error registering new user");
}
Auth::login($user, true);
} else {
$parameters = compact('fname', "lname", 'email');
$to = route('register', $parameters);
Expand Down
5 changes: 5 additions & 0 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class EventServiceProvider extends ServiceProvider
Registered::class => [
ConfiguredSendEmailVerificationNotification::class,
],
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
// ... other providers
\SocialiteProviders\GitLab\GitLabExtendSocialite::class.'@handle',
\SocialiteProviders\GitHub\GitHubExtendSocialite::class.'@handle',
],
];

/**
Expand Down
50 changes: 0 additions & 50 deletions app/cdash/app/Middleware/OAuth2/GitLab.php

This file was deleted.

31 changes: 0 additions & 31 deletions app/cdash/public/auth/GitLab.php

This file was deleted.

Binary file modified app/cdash/public/img/gitlab_signin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion app/cdash/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ add_unit_test(/CDash/Messaging/Topic/TestFailureTopic)
add_unit_test(/CDash/Messaging/Topic/TopicDecorator)
add_unit_test(/CDash/Messaging/Topic/UpdateErrorTopic)
add_unit_test(/CDash/Middleware/OAuth2)
add_unit_test(/CDash/Middleware/OAuth2/GitLab)
add_unit_test(/CDash/Middleware/OAuth2/Google)
add_unit_test(/CDash/Model/BuildError)
add_unit_test(/CDash/Model/BuildErrorFilter)
Expand Down
31 changes: 0 additions & 31 deletions app/cdash/tests/case/CDash/Middleware/OAuth2/GitLabTest.php

This file was deleted.

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"pear/archive_tar": "1.4.14",
"php-di/php-di": "7.0.5",
"ramsey/uuid": "4.7.5",
"socialiteproviders/github": "4.1.0"
"socialiteproviders/github": "4.1.0",
"socialiteproviders/gitlab": "4.1.0"
},
"require-dev": {
"ext-dom": "*",
Expand Down
43 changes: 42 additions & 1 deletion composer.lock

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

8 changes: 0 additions & 8 deletions config/oauth2.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
<?php

use CDash\Middleware\OAuth2\GitLab;
use CDash\Middleware\OAuth2\Google;

return [
'gitlab' => [
'clientId' => env('GITLAB_CLIENT_ID'),
'clientSecret' => env('GITLAB_CLIENT_SECRET'),
'domain' => env('GITLAB_DOMAIN', 'https://gitlab.com'),
'className' => GitLab::class,
'enable' => env('GITLAB_ENABLE', false),
],
'google' => [
'clientId' => env('GOOGLE_CLIENT_ID'),
'clientSecret' => env('GOOGLE_CLIENT_SECRET'),
Expand Down
10 changes: 10 additions & 0 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
'oauth' => true,
'display_name' => "GitHub",
],
'gitlab' => [
'client_id' => env('GITLAB_CLIENT_ID'),
'client_secret' => env('GITLAB_CLIENT_SECRET'),
'redirect' => env('GITLAB_REDIRECT_URI'),
'instance_uri' => env('GITLAB_DOMAIN'),
'enable' => env('GITLAB_ENABLE', false),
'autoregister' => env('GITLAB_AUTO_REGISTER_NEW_USERS', false),
'oauth' => true,
'display_name' => "GitLab",
],
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
Expand Down
20 changes: 0 additions & 20 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -18284,16 +18284,6 @@ parameters:
count: 1
path: app/cdash/public/api/v1/subproject.php

-
message: "#^Call to an undefined method CDash\\\\Middleware\\\\OAuth2\\\\GitLab\\:\\:auth\\(\\)\\.$#"
count: 1
path: app/cdash/public/auth/GitLab.php

-
message: "#^Class CDash\\\\Middleware\\\\OAuth2\\\\GitLab constructor invoked with 3 parameters, 0 required\\.$#"
count: 1
path: app/cdash/public/auth/GitLab.php

-
message: "#^Call to an undefined method CDash\\\\Middleware\\\\OAuth2\\\\Google\\:\\:auth\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -20350,16 +20340,6 @@ parameters:
count: 1
path: app/cdash/tests/case/CDash/Messaging/Topic/UpdateErrorTopicTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\)\\.$#"
count: 1
path: app/cdash/tests/case/CDash/Middleware/OAuth2/GitLabTest.php

-
message: "#^Method GitLabTest\\:\\:testGetProvider\\(\\) has no return type specified\\.$#"
count: 1
path: app/cdash/tests/case/CDash/Middleware/OAuth2/GitLabTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\)\\.$#"
count: 1
Expand Down