|
1 | 1 | require 'redmine'
|
2 |
| -require 'redmine_omniauth_cas' |
3 |
| -require 'redmine_omniauth_cas/hooks' |
4 |
| -require 'omniauth/patches' |
5 |
| -require 'omniauth/dynamic_full_host' |
| 2 | +require 'redmine_omniauth_saml' |
| 3 | +require 'redmine_omniauth_saml/hooks' |
6 | 4 |
|
7 | 5 | # Patches to existing classes/modules
|
8 | 6 | ActionDispatch::Callbacks.to_prepare do
|
9 |
| - require_dependency 'redmine_omniauth_cas/account_helper_patch' |
10 |
| - require_dependency 'redmine_omniauth_cas/account_controller_patch' |
| 7 | + require_dependency 'redmine_omniauth_saml/account_helper_patch' |
| 8 | + require_dependency 'redmine_omniauth_saml/account_controller_patch' |
11 | 9 | end
|
12 | 10 |
|
13 | 11 | # Plugin generic informations
|
14 |
| -Redmine::Plugin.register :redmine_omniauth_cas do |
15 |
| - name 'Redmine Omniauth plugin' |
16 |
| - description 'This plugin adds Omniauth support to Redmine' |
17 |
| - author 'Jean-Baptiste BARTH' |
18 |
| - author_url 'mailto:[email protected]' |
19 |
| - url 'https://github.com/jbbarth/redmine_omniauth_cas' |
20 |
| - version '0.1.2' |
21 |
| - requires_redmine :version_or_higher => '2.0.0' |
22 |
| - settings :default => { 'enabled' => 'true', 'label_login_with_cas' => '', 'cas_server' => '' }, |
23 |
| - :partial => 'settings/omniauth_cas_settings' |
| 12 | +Redmine::Plugin.register :redmine_omniauth_saml do |
| 13 | + name 'Redmine Omniauth SAML plugin' |
| 14 | + description 'This plugin adds Omniauth SAML support to Redmine. Based in Omniauth CAS plugin' |
| 15 | + author 'Christian A. Rodriguez' |
| 16 | + author_url 'mailto:[email protected]' |
| 17 | + url 'https://github.com/chrodriguez/redmine_omniauth_saml' |
| 18 | + version '0.0.1' |
| 19 | + requires_redmine :version_or_higher => '2.3.0' |
| 20 | + settings :default => { 'enabled' => 'true', 'label_login_with_saml' => '' }, |
| 21 | + :partial => 'settings/omniauth_saml_settings' |
24 | 22 | end
|
25 | 23 |
|
26 |
| -# OmniAuth CAS |
27 |
| -setup_app = Proc.new do |env| |
28 |
| - addr = Redmine::OmniAuthCAS.cas_server |
29 |
| - cas_server = URI.parse(addr) |
30 |
| - if cas_server |
31 |
| - env['omniauth.strategy'].options.merge! :host => cas_server.host, |
32 |
| - :port => cas_server.port, |
33 |
| - :path => (cas_server.path != "/" ? cas_server.path : nil), |
34 |
| - :ssl => cas_server.scheme == "https" |
35 |
| - end |
36 |
| - validate = Redmine::OmniAuthCAS.cas_service_validate_url |
37 |
| - if validate |
38 |
| - env['omniauth.strategy'].options.merge! :service_validate_url => validate |
39 |
| - end |
40 |
| - # Dirty, not happy with it, but as long as I can't reproduce the bug |
41 |
| - # users are blocked because of failing OpenSSL checks, while the cert |
42 |
| - # is actually good, so... |
43 |
| - # TODO: try to understand why cert verification fails |
44 |
| - # Maybe https://github.com/intridea/omniauth/issues/404 can help |
45 |
| - env['omniauth.strategy'].options.merge! :disable_ssl_verification => true |
46 |
| -end |
47 |
| - |
48 |
| -# tell Rails we use this middleware, with some default value just in case |
49 |
| -Rails.application.config.middleware.use OmniAuth::Builder do |
50 |
| - #url = "http://nadine.application.ac.centre-serveur.i2/" |
51 |
| - use OmniAuth::Strategies::CAS, :host => "localhost", |
52 |
| - :port => "9292", |
53 |
| - :ssl => false, |
54 |
| - :setup => setup_app |
55 |
| -end |
0 commit comments