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: Implement OIDC sign-in #9251

Open
wants to merge 245 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
245 commits
Select commit Hold shift + click to select a range
c2c8644
deps(cpan): Install OIDC::Lite
hangy Oct 28, 2023
23cc509
chg: Add sign_in.pl to redirect to OIDC
hangy Oct 28, 2023
77fc76e
chg: Dynamically build URIs
hangy Oct 29, 2023
f1eaf1a
chg: Add dummy OIDC client
hangy Oct 29, 2023
bce027f
chg: Deploy keycloak in dev container
hangy Oct 29, 2023
e964865
dev: Add dev realm to keycloak deployment
hangy Oct 29, 2023
476c5f1
wip: Get userinfo from keycloak
hangy Nov 4, 2023
0f4e6e5
Merge remote-tracking branch 'origin/main' into keycloak
hangy Nov 4, 2023
f1320c9
feat: Implement Resource Owner Password Credentials Grant
hangy Nov 10, 2023
784997c
Update keycloak dev realm
hangy Nov 13, 2023
a52795c
chg: Disable email verification for local dev
hangy Nov 20, 2023
c9ab30d
chg: Store OIDC tokens in session
hangy Nov 20, 2023
2537604
chg: Store token expiration in user session
hangy Nov 20, 2023
b845b49
chg: Switch URL from auth.* to accounts.*
hangy Nov 20, 2023
3b12ab3
feat: Open new session on OIDC callback
hangy Nov 20, 2023
f00ed5c
Merge remote-tracking branch 'origin/main' into keycloak
hangy Nov 20, 2023
de9aad3
feat: Replace custom password reset with redirect to Keycloak
hangy Nov 21, 2023
45572d9
chg: Automatically create user upon OIDC callback
hangy Nov 21, 2023
8decb47
Merge remote-tracking branch 'origin/main' into keycloak
hangy Nov 25, 2023
3312a22
wip: Verification of ID Token
hangy Nov 26, 2023
aaf5de3
refactor: Use new `$BASE_DIRS{USERS}` instead of `$data_root/users`.
hangy Nov 26, 2023
988991b
chg: Verify ID token using newer JWT lib
hangy Nov 26, 2023
2d99146
chg: Attempt to verify Bearer token for the API
hangy Nov 26, 2023
201cb49
refactor: Use new `$BASE_DIRS{USERS}` instead of `$data_root/users`.
hangy Nov 26, 2023
cfb7e15
deps(Docker): Bump keycloak from 22.0.5 to 23.0.0
hangy Nov 27, 2023
df5cf64
chg: Add Hoppscotch for API testing
hangy Nov 27, 2023
ebb1e33
wip: Create users in Keycloak from inside Product Opener for backward…
hangy Nov 27, 2023
c721930
fix: Default $return_url to root of current subdomain
hangy Dec 2, 2023
77e6984
chg: Redirect change_password to keycloak
hangy Dec 2, 2023
6ed8ef6
chg: Use id_token instead userinfo endpoint
hangy Dec 2, 2023
dd20a59
feat: Create user file on API request with token
hangy Dec 2, 2023
7e63735
Merge remote-tracking branch 'origin/main' into keycloak
hangy Dec 2, 2023
9feed4a
chg: Use user_id from id token for API requests
hangy Dec 3, 2023
5a6ac7a
feat: Create Keycloak user via REST API
hangy Dec 5, 2023
6391b32
Merge remote-tracking branch 'origin/main' into keycloak
hangy Dec 5, 2023
9233cd1
chg: Start keycloak for tests, and use more complex password for tests
hangy Dec 6, 2023
6979e1a
chg: Dynamically OIDC data from documents
hangy Dec 6, 2023
e41eb0e
chg: Use location header to get info about created user
hangy Dec 10, 2023
6fc654b
chg: Delete users in Keycloak during tests
hangy Dec 10, 2023
c909190
Merge remote-tracking branch 'origin/main' into keycloak
hangy Dec 10, 2023
1691c7f
test: Use new password in integration tests
hangy Dec 11, 2023
7897fb6
Merge remote-tracking branch 'origin/main' into keycloak
hangy Dec 11, 2023
a00c626
test: Update expected test result
hangy Dec 11, 2023
b6723b3
Merge remote-tracking branch 'origin/main' into keycloak
hangy Dec 12, 2023
9880524
chg: Use `LWP::UserAgent::Plugin::Retry` for manual Keycloak calls
hangy Dec 12, 2023
9562233
Merge remote-tracking branch 'origin/main' into keycloak
hangy Dec 12, 2023
e6054f7
test: Wait for our Keycloak realm to be ready before running integrat…
hangy Dec 12, 2023
f3fd64b
test: Swap order of `wait_application_ready` and `remove_all_users`
hangy Dec 12, 2023
38c0345
Merge branch 'main' into keycloak
hangy Dec 12, 2023
9a8323b
Merge remote-tracking branch 'origin/main' into keycloak
hangy Dec 15, 2023
87b8342
wip: Log client_id in change log
hangy Dec 15, 2023
595a406
Merge branch 'main' into keycloak
hangy Dec 18, 2023
2cde5bd
wip: Verify azp?
hangy Dec 19, 2023
0ed82d9
feat: Start keycloak with devcontainer
hangy Dec 25, 2023
8597ead
fix: Header name is Authorization, not Authentication
hangy Dec 25, 2023
5df9d1d
fix: iss is named issues in OIDC discovery
hangy Dec 25, 2023
2e39264
test: Verify created_by_client and last_modified_by_client
hangy Dec 25, 2023
0f4f40e
feat: Init user session for API request
hangy Dec 25, 2023
06dbe17
test: Fix patch-auth-bad-oauth-token
hangy Dec 25, 2023
e3de534
Merge remote-tracking branch 'upstream/main' into keycloak
hangy Dec 25, 2023
ce75f72
tests: Move wait_application_ready up
hangy Dec 25, 2023
37187c7
Merge remote-tracking branch 'upstream/main' into keycloak
hangy Dec 25, 2023
fdd203a
chg: Store tokens from session in request, to make them available to …
hangy Dec 26, 2023
af511b0
docs: Improve Auth docs a tiny bit
hangy Dec 26, 2023
c3bf43b
Merge remote-tracking branch 'upstream/main' into keycloak
hangy Dec 26, 2023
5e4714e
feat: Write Deprecation and Sunset headers for old login/SSO urls
hangy Dec 29, 2023
e5bf4e4
feat: Require user to be signed in to open user.pl
hangy Dec 29, 2023
fd2b26a
feat: Use oidc-signin for 'sign in' link
hangy Dec 29, 2023
02341a3
feat: Implement single sign-out with Keycloak
hangy Dec 30, 2023
72549af
Revert "feat: Require user to be signed in to open user.pl"
hangy Dec 30, 2023
6c1cf61
chg: Add scrypt module to Keycloak to enable using existing passwords
hangy Jan 6, 2024
c02723f
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jan 6, 2024
6c3f2a5
fix: Use newer version of keycloak-scrypt, which works with Keycloak …
hangy Jan 7, 2024
7402d27
wip: Add user migration script
hangy Jan 7, 2024
8835f69
fix: Use different library for scrypt
hangy Jan 14, 2024
b8a8326
docs: Document more Perl code
hangy Jan 19, 2024
05528fa
docs: Apply suggestions from code review
hangy Jan 19, 2024
b5fde3d
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jan 19, 2024
c618aaf
chg: Use `retrieve_user` to load user file
hangy Jan 19, 2024
a9c912a
docs: Improve docs of OIDC related code.
hangy Jan 19, 2024
3704cab
refactor: Extract get_cookie_domain to sub
hangy Jan 19, 2024
d1389d9
fix: Use preferred_language and country instead of initial_lc and ini…
hangy Jan 19, 2024
1de649b
perf: Reuse existing token until it times out
hangy Jan 20, 2024
0391333
chg: Show error instead of attempting infinite loop if someone might …
hangy Jan 20, 2024
8c7367f
docs: Add perldoc to some Auth subs
hangy Jan 20, 2024
4e52c29
fix: Typo
hangy Jan 20, 2024
36051db
deps: Update Dockerfile.keycloak
hangy Jan 24, 2024
94e1d36
fix: fix docker profile repetition for postgresql container
alexgarel Jan 25, 2024
f1c70d3
Merge branch 'main' into build-docker-profile-postgres
alexgarel Jan 26, 2024
01154d1
feat: Update email handling when dealing with OIDC
hangy Jan 27, 2024
aad2cc1
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jan 27, 2024
3e2b777
Merge remote-tracking branch 'origin/build-docker-profile-postgres' i…
hangy Jan 27, 2024
3308bc6
refactor: Move Keycloak/OIDC settings to ENV vars
hangy Jan 27, 2024
5e74b72
deps: Use pre-built custom Keycloak image
hangy Jan 28, 2024
66281dd
fix: spelling
hangy Jan 28, 2024
bb54f43
fix: Add some stopwords
hangy Jan 28, 2024
32f4eef
fix(test): Add missing import
hangy Jan 28, 2024
dc728b6
feat: Display clientid in product history
hangy Jan 28, 2024
0e1595d
refactor: dashes to underscores
hangy Jan 28, 2024
6f195f1
feat: Try parsing auth header Display
hangy Jan 28, 2024
53cb448
deps: Update Keycloak container from 23.0.4 to 23.0.6
hangy Feb 3, 2024
a580c5d
wip: Import Keycloak users using partial import
hangy Feb 3, 2024
4aefbaf
chg: Import users in more manageable batches
hangy Feb 3, 2024
1797b7b
Merge remote-tracking branch 'origin/main' into keycloak
hangy Feb 3, 2024
d12cbc0
Merge remote-tracking branch 'origin/main' into keycloak
hangy Feb 7, 2024
ca5f24f
fix(tests): Integration tests working on my machine
hangy Feb 7, 2024
9a4c1ef
fix: Merge mistake
hangy Feb 7, 2024
b1bd9f7
test: Add some integration tests for OIDC
hangy Feb 11, 2024
a0d3e9e
Merge remote-tracking branch 'upstream/main' into keycloak
hangy Feb 15, 2024
70dcc26
feat: Remove old login forms but try to keep compatibility, remove po…
hangy Feb 15, 2024
24af950
fix: Update importedApache2::Consts
hangy Feb 16, 2024
541809c
deps: Remove some old CPAN modules and let Keycloak worry babout emai…
hangy Feb 18, 2024
fc50fbc
fix: Partial revert of 70dcc269949d66d230b0ee0c1687c61ec2c93355
hangy Feb 18, 2024
68b8744
fix: Don't overwrite login status
hangy Feb 18, 2024
c6dc534
chg!: Limit fields that can be edited
hangy Feb 18, 2024
7fe580d
refactor: Move Keycloak-specific stuff to dedicated class, so that we…
hangy Mar 2, 2024
b64deba
chg: Check existing mail address from Keycloak instead of users_email…
hangy Mar 2, 2024
6638c50
chg: Deprecate users_emails.sto for existence check
hangy Mar 2, 2024
17b333a
replace try_retrieve_userid_from_mail with is_email_has_off_account
hangy Mar 2, 2024
f79f48d
feat: Pass country / language to login page
hangy Mar 2, 2024
cf3d62a
Merge branch 'main' into keycloak
hangy Mar 4, 2024
bf4e00b
Merge remote-tracking branch 'upstream/main' into keycloak
hangy Mar 7, 2024
7aef570
deps: Update openfoodfacts-auth image
hangy Mar 7, 2024
126f08f
Merge remote-tracking branch 'upstream/main' into keycloak
hangy Mar 9, 2024
59ae976
fix: update test to changes from main
hangy Mar 10, 2024
135c515
wip: Add redis
hangy Mar 13, 2024
82557db
fix: Init and shut down AnyEvent for async stuff
hangy Mar 14, 2024
b590285
Attempt at a redis subscription
hangy Mar 14, 2024
88739f2
Merge branch 'main' into keycloak
hangy Mar 15, 2024
bf42537
Merge remote-tracking branch 'origin/keycloak' into keycloak-redis
hangy Mar 15, 2024
1fdabca
Merge remote-tracking branch 'origin/main' into keycloak
hangy Mar 18, 2024
3ed42ab
Merge branch 'keycloak' into keycloak-redis
hangy Mar 18, 2024
cb80395
Add redis-listener service to docker-compose.yml and prod.yml
hangy Mar 18, 2024
acc6b7c
deps: Update openfoodfacts-auth image
hangy Mar 19, 2024
7f1ae34
dev: Update container deps
hangy Mar 20, 2024
f8394a6
wip: Read from stream
hangy Mar 20, 2024
bf28080
Merge remote-tracking branch 'origin/main' into keycloak
john-gom Mar 24, 2024
aa282e7
Merge remote-tracking branch 'origin/keycloak' into keycloak-redis
hangy Mar 24, 2024
c813c17
feat: Create Minion task from deleted user Redis event
hangy Mar 25, 2024
172db00
Merge remote-tracking branch 'origin/main' into keycloak
hangy Mar 25, 2024
823df66
fix: `$lang` => `$lc`
hangy Mar 26, 2024
2731b43
Merge remote-tracking branch 'origin/main' into keycloak
hangy Mar 27, 2024
86dccbb
fix: Add missing import
hangy Mar 28, 2024
aaf6137
Merge remote-tracking branch 'origin/main' into keycloak
hangy Mar 28, 2024
d5258dd
feat: Remove user deletion from user.pl
hangy Mar 28, 2024
56181ae
fix: Correct `use` statements
hangy Mar 30, 2024
e0e18f2
Merge remote-tracking branch 'origin/main' into keycloak
hangy Apr 3, 2024
5bf4e8c
dev: Update container deps
hangy Apr 3, 2024
234fe7a
fix: POD for Keycloak/Auth module
hangy Apr 3, 2024
247229b
fix: Update integration tests
hangy Apr 3, 2024
e92569b
fix: Only write old users_emails if it exists already
hangy Apr 4, 2024
cd5293f
Fix email retrieval bug and add new user authentication tests
hangy Apr 6, 2024
5c740a6
Merge remote-tracking branch 'origin/main' into keycloak
hangy Apr 6, 2024
2b773d5
fix: Use preferred username as display name
hangy Apr 7, 2024
f392ea9
fix: Always store emails
hangy Apr 7, 2024
ab420c3
feat: Pass `ui_locales` to Keycloak
hangy Apr 7, 2024
7dc9a57
chg: Accept all mail addresses
hangy Apr 7, 2024
e4b7347
Depreacte `users_emails.sto`
hangy Apr 7, 2024
a2ea550
Refactor email account retrieval and creation in Keycloak
hangy Apr 7, 2024
4bc21f9
fix: Support $request_ref in more places
hangy Apr 13, 2024
754bfff
Merge remote-tracking branch 'origin/main' into keycloak
hangy Apr 13, 2024
f0a176f
dev: Update container deps
hangy Apr 21, 2024
66a7fdd
fix: Expose keycloak behind proxy to reenable discovery
hangy May 5, 2024
c027498
Merge remote-tracking branch 'origin/main' into keycloak
hangy May 5, 2024
b9625bf
fix: s/auth.openfoodfacts.localhost:8080/auth.openfoodfacts.localhost/
hangy May 5, 2024
1b8b39b
User migration
hangy May 5, 2024
94fd78d
dev: Update env vars after tests with actual reverse proxy on https:/…
hangy May 5, 2024
183f225
Pull keycloak dependency from a separate project
john-gom May 6, 2024
a2d56cb
Fix one test
john-gom May 6, 2024
a6a333f
Forgot to add deps as a dependency
john-gom May 6, 2024
d004b75
Remove env vars no longer needed
john-gom May 10, 2024
0938955
Tests are still responsible for creating their own dependencies
john-gom May 10, 2024
1db9f6e
Merge branch 'main' into keycloak
john-gom May 10, 2024
4ea0389
Merge remote-tracking branch 'origin/main' into keycloak
hangy May 27, 2024
48fc609
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jun 21, 2024
20c718b
Fix deps
john-gom Jun 25, 2024
d0251b9
Restore removed translations
john-gom Jun 25, 2024
302dfef
Fetch keycloak compose from off-auth repo
john-gom Jun 26, 2024
16b2746
Update test results
john-gom Jun 26, 2024
90f2521
Add keycloak health dependency for integration tests
john-gom Jun 28, 2024
de411ec
Use integration-test compose for test stop
john-gom Jun 28, 2024
cf6e0aa
Remove redundant code from update_tests_results
john-gom Jun 28, 2024
eafb82c
Remove unnecessary vars
john-gom Jul 5, 2024
e7d687a
chore: Add redis-listener service to docker run configuration
hangy Jul 7, 2024
100ec40
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jul 7, 2024
100fb64
chore: Ignore deps when building container images
hangy Jul 7, 2024
d18c0a2
fix: Adopt d9d9a70872e443e6c7e5f6f2982f3dccc660921c
hangy Jul 7, 2024
a5810ab
build(deps-dev): Add `UUID` module
hangy Jul 14, 2024
1d45efd
text: Update expected integration test results
hangy Jul 14, 2024
bda3882
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jul 14, 2024
466b6e7
test: Update expected integration test results
hangy Jul 14, 2024
4e71747
Merge remote-tracking branch 'origin/cpan-uuid' into keycloak
hangy Jul 20, 2024
16d407e
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jul 20, 2024
3e36d45
test: Update expected test results after latest merge
hangy Jul 21, 2024
5c2ba8b
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jul 25, 2024
f6306b3
style: Lint perl. Sorry!
hangy Jul 26, 2024
9fda250
refactor: Move Minion methods to separate module
hangy Jul 27, 2024
3f64b82
test: Manually ensure that user deletion from Redis causes Minion job…
hangy Jul 27, 2024
df355e2
test: refactor delete_user.t to depend on less external events
hangy Jul 27, 2024
a7a2165
Merge remote-tracking branch 'origin/main' into keycloak
hangy Jul 27, 2024
b0d675c
refactor: Separate front- and backchannel URL for Keyclaok
hangy Jul 27, 2024
492cdc4
Merge remote-tracking branch 'origin/main' into keycloak
hangy Aug 8, 2024
4d0ba00
Merge branch 'main' into keycloak
hangy Aug 12, 2024
f5bb6a7
feat: Move keycloak account link from user page to dropdown menu
hangy Aug 17, 2024
4e0b65b
Merge remote-tracking branch 'origin/main' into keycloak
hangy Aug 17, 2024
32c4000
test: Update tests results
Aug 17, 2024
9d4061f
Merge remote-tracking branch 'origin/main' into keycloak
hangy Aug 30, 2024
a3de4e9
test: Update tests results
Aug 30, 2024
f785606
refactor: Update keycloak account link generation
hangy Sep 8, 2024
cbe5fe5
test: Update tests results
hangy Sep 8, 2024
54ff395
chg: Add import timestamp
hangy Sep 15, 2024
389d8a8
feat: Add anonymization option for user migration script
hangy Sep 15, 2024
57f835a
Merge branch 'main' into keycloak
hangy Sep 15, 2024
e852eab
fix: fix unit tests
raphael0202 Sep 17, 2024
aa0b56d
Merge remote-tracking branch 'hangy/main' into keycloak
hangy Sep 17, 2024
bb9d25e
Merge remote-tracking branch 'hangy/main' into keycloak
hangy Sep 19, 2024
7115cec
test: Update test results after template changes
hangy Sep 19, 2024
be4a668
test: Run API test with fresh UA each time, and randomize API test ex…
hangy Sep 20, 2024
36e27b1
wip: Add tasks to handle welcoming users and registering them to the …
hangy Sep 23, 2024
839c21a
Revert "test: Run API test with fresh UA each time, and randomize API…
hangy Sep 25, 2024
8c1cee6
fix: Syntax issues
hangy Sep 25, 2024
7d36b09
fix(tests): Run some API tests with fresh UA
hangy Sep 25, 2024
976127e
Add support for SSL in local development
john-gom Sep 27, 2024
e0e05bf
Revert "Add support for SSL in local development"
john-gom Sep 30, 2024
5ed1e6f
Merge remote-tracking branch 'hangy/main' into keycloak
hangy Oct 2, 2024
3c3f633
test: Update expected test results after latest merge
hangy Oct 6, 2024
da1e938
fix: s/be-fr/world
hangy Oct 8, 2024
48e1cba
Merge remote-tracking branch 'hangy/main' into keycloak
hangy Oct 8, 2024
499b54a
fix: Use 'subscribe' instead of '1' for the newsletter
hangy Oct 12, 2024
c5acaaa
fix: Use correct syntax for listening to multiple redis streams
hangy Oct 13, 2024
04ad127
fix: Update sign-in URLs in site layout templates
hangy Oct 15, 2024
42ecbb3
feat: Use Keycloak instead of manual login form for product edit pages
hangy Oct 15, 2024
e5e898f
fix: Update return URL for unauthenticated users in product_multiling…
hangy Oct 17, 2024
34ad306
Merge remote-tracking branch 'hangy/main' into keycloak
hangy Oct 17, 2024
b58e9e3
Get org data from keycloak events
john-gom Oct 24, 2024
4fab219
Fix warnings
john-gom Oct 24, 2024
31d8925
Populate extra user fields on first creation
john-gom Oct 24, 2024
d2b785f
Always set fields for existing users
john-gom Oct 24, 2024
313cfbb
Revert change no longer needed
john-gom Oct 25, 2024
c0f3ea0
fix(docs): Grammar
hangy Oct 25, 2024
6ea0245
Revert "fix(docs): Grammar"
john-gom Oct 25, 2024
7ce8d08
Merge branch 'main' into keycloak
john-gom Oct 25, 2024
22a0f18
Merge remote-tracking branch 'hangy/main' into keycloak
hangy Nov 14, 2024
be4f654
Merge remote-tracking branch 'hangy/main' into keycloak
hangy Nov 14, 2024
118b4e9
nit: Make `Perl::Critic` happy by using american spelling
hangy Nov 14, 2024
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
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ ELASTICSEARCH_HOSTS=
LOG_LEVEL_ROOT=TRACE
LOG_LEVEL_MONGODB=TRACE

KEYCLOAK_ADMIN=root
KEYCLOAK_ADMIN_PASSWORD=test

BUILD_CACHE_REPO=openfoodfacts/openfoodfacts-build-cache
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt set -x && \
# gnu readline
libreadline-dev \
# IO::AIO needed by Perl::LanguageServer
libperl-dev
libperl-dev \
# OpenSSL dev needed by OIDC::Lite
libssl-dev

# Run www-data user as host user 'off' or developper uid
ARG USER_UID
Expand Down
51 changes: 51 additions & 0 deletions cgi/oidc-callback.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/perl -w
hangy marked this conversation as resolved.
Show resolved Hide resolved

# This file is part of Product Opener.
#
# Product Opener
# Copyright (C) 2011-2023 Association Open Food Facts
# Contact: [email protected]
# Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France
#
# Product Opener is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

use ProductOpener::PerlStandards;

use CGI::Carp qw(fatalsToBrowser);

use ProductOpener::Auth qw/:all/;
use ProductOpener::Display qw/:all/;
use ProductOpener::Routing qw/:all/;
use ProductOpener::Users qw/:all/;

use Log::Any qw($log);

$log->info('start') if $log->is_info();

my $request_ref = init_request();
analyze_request($request_ref);

my $return_url = callback($request_ref);

unless (defined $User_id) {
display_error_and_exit('Unauthorized', 401);
}

unless (defined $return_url) {
$return_url = format_subdomain('world');
}

redirect_to_url($request_ref, 302, $return_url);

1;
40 changes: 40 additions & 0 deletions cgi/oidc-signin.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/perl -w

# This file is part of Product Opener.
#
# Product Opener
# Copyright (C) 2011-2023 Association Open Food Facts
# Contact: [email protected]
# Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France
#
# Product Opener is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

hangy marked this conversation as resolved.
Show resolved Hide resolved
use ProductOpener::PerlStandards;

use CGI::Carp qw(fatalsToBrowser);

use ProductOpener::Auth qw/:all/;
use ProductOpener::Display qw/:all/;
use ProductOpener::Routing qw/:all/;

use Log::Any qw($log);

$log->info('start') if $log->is_info();

my $request_ref = init_request();
analyze_request($request_ref);

access_to_protected_resource($request_ref);

1;
Loading
Loading