|
1 |
| -Rails.application.config.after_initialize do |
2 |
| - namespace = OpenProject::Authentication::Strategies::Warden |
| 1 | +# frozen_string_literal: true |
3 | 2 |
|
4 |
| - strategies = [ |
5 |
| - [:basic_auth_failure, namespace::BasicAuthFailure, "Basic"], |
6 |
| - [:global_basic_auth, namespace::GlobalBasicAuth, "Basic"], |
7 |
| - [:user_basic_auth, namespace::UserBasicAuth, "Basic"], |
8 |
| - [:oauth, namespace::DoorkeeperOAuth, "Bearer"], |
9 |
| - [:anonymous_fallback, namespace::AnonymousFallback, "Basic"], |
10 |
| - [:jwt_oidc, namespace::JwtOidc, "Bearer"], |
11 |
| - [:session, namespace::Session, "Session"] |
12 |
| - ] |
| 3 | +namespace = OpenProject::Authentication::Strategies::Warden |
13 | 4 |
|
14 |
| - strategies.each do |name, clazz, auth_scheme| |
15 |
| - OpenProject::Authentication.add_strategy(name, clazz, auth_scheme) |
16 |
| - end |
| 5 | +strategies = [ |
| 6 | + [:basic_auth_failure, namespace::BasicAuthFailure, "Basic"], |
| 7 | + [:global_basic_auth, namespace::GlobalBasicAuth, "Basic"], |
| 8 | + [:user_basic_auth, namespace::UserBasicAuth, "Basic"], |
| 9 | + [:oauth, namespace::DoorkeeperOAuth, "Bearer"], |
| 10 | + [:anonymous_fallback, namespace::AnonymousFallback, "Basic"], |
| 11 | + [:jwt_oidc, namespace::JwtOidc, "Bearer"], |
| 12 | + [:session, namespace::Session, "Session"] |
| 13 | +] |
17 | 14 |
|
18 |
| - OpenProject::Authentication.update_strategies(OpenProject::Authentication::Scope::API_V3, { store: false }) do |_| |
19 |
| - %i[global_basic_auth |
20 |
| - user_basic_auth |
21 |
| - basic_auth_failure |
22 |
| - oauth |
23 |
| - jwt_oidc |
24 |
| - session |
25 |
| - anonymous_fallback] |
26 |
| - end |
| 15 | +strategies.each do |name, clazz, auth_scheme| |
| 16 | + OpenProject::Authentication.add_strategy(name, clazz, auth_scheme) |
| 17 | +end |
| 18 | + |
| 19 | +OpenProject::Authentication.update_strategies(OpenProject::Authentication::Scope::API_V3, { store: false }) do |_| |
| 20 | + %i[global_basic_auth |
| 21 | + user_basic_auth |
| 22 | + basic_auth_failure |
| 23 | + oauth |
| 24 | + jwt_oidc |
| 25 | + session |
| 26 | + anonymous_fallback] |
| 27 | +end |
| 28 | + |
| 29 | +Rails.application.configure do |app| |
| 30 | + app.config.middleware.use OpenProject::Authentication::Manager, intercept_401: false |
27 | 31 | end
|
0 commit comments