@@ -23,38 +23,37 @@ class Engine < ::Rails::Engine
23
23
initializer 'RpiAuth.add_middleware' do |app | # rubocop:disable Metrics/BlockLength
24
24
next unless RpiAuth . configuration
25
25
26
- # rubocop:disable Metrics/BlockLength
26
+ openid_connect_options = {
27
+ name : :rpi ,
28
+ setup : RpiAuth . configuration . setup ,
29
+ issuer : RpiAuth . configuration . issuer ,
30
+ scope : RpiAuth . configuration . scope ,
31
+ callback_path : CALLBACK_PATH ,
32
+ response_type : RpiAuth . configuration . response_type ,
33
+ client_auth_method : RpiAuth . configuration . client_auth_method ,
34
+ client_options : {
35
+ identifier : RpiAuth . configuration . auth_client_id ,
36
+ secret : RpiAuth . configuration . auth_client_secret ,
37
+ scheme : RpiAuth . configuration . token_endpoint . scheme ,
38
+ host : RpiAuth . configuration . token_endpoint . host ,
39
+ port : RpiAuth . configuration . token_endpoint . port ,
40
+ authorization_endpoint : RpiAuth . configuration . authorization_endpoint ,
41
+ token_endpoint : RpiAuth . configuration . token_endpoint ,
42
+ jwks_uri : RpiAuth . configuration . jwks_uri ,
43
+ redirect_uri : URI . join ( RpiAuth . configuration . host_url , CALLBACK_PATH )
44
+ } ,
45
+ extra_authorize_params : { brand : RpiAuth . configuration . brand } ,
46
+ allow_authorize_params : [ :login_options ] ,
47
+ origin_param : 'returnTo'
48
+ }
49
+
27
50
app . middleware . use OmniAuth ::Builder do
28
- provider (
29
- :openid_connect ,
30
- name : :rpi ,
31
- setup : RpiAuth . configuration . setup ,
32
- issuer : RpiAuth . configuration . issuer ,
33
- scope : RpiAuth . configuration . scope ,
34
- callback_path : CALLBACK_PATH ,
35
- response_type : RpiAuth . configuration . response_type ,
36
- client_auth_method : RpiAuth . configuration . client_auth_method ,
37
- client_options : {
38
- identifier : RpiAuth . configuration . auth_client_id ,
39
- secret : RpiAuth . configuration . auth_client_secret ,
40
- scheme : RpiAuth . configuration . token_endpoint . scheme ,
41
- host : RpiAuth . configuration . token_endpoint . host ,
42
- port : RpiAuth . configuration . token_endpoint . port ,
43
- authorization_endpoint : RpiAuth . configuration . authorization_endpoint ,
44
- token_endpoint : RpiAuth . configuration . token_endpoint ,
45
- jwks_uri : RpiAuth . configuration . jwks_uri ,
46
- redirect_uri : URI . join ( RpiAuth . configuration . host_url , CALLBACK_PATH )
47
- } ,
48
- extra_authorize_params : { brand : RpiAuth . configuration . brand } ,
49
- allow_authorize_params : [ :login_options ] ,
50
- origin_param : 'returnTo'
51
- )
51
+ provider ( :openid_connect , openid_connect_options )
52
52
53
53
OmniAuth . config . on_failure = RpiAuth ::AuthController . action ( :failure )
54
54
55
55
RpiAuth . configuration . enable_auth_bypass if RpiAuth . configuration . bypass_auth
56
56
end
57
- # rubocop:enable Metrics/BlockLength
58
57
end
59
58
end
60
59
end
0 commit comments