mumukit-login 6.1.1 → 6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/login.rb +1 -0
- data/lib/mumukit/login/provider.rb +15 -8
- data/lib/mumukit/login/provider/cas.rb +23 -4
- data/lib/mumukit/login/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e253118b608f53f7d20743dc81cf0fa9322ee4689d46aa7a49077d33c84041c
|
4
|
+
data.tar.gz: 521feb734a561c1cd29700802d2dd448f1b0dcb46967e518bd6ecb626ab3ed03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a5e754fe88910cae7739255c8579219e590a737d33ce263e74bb5d95bcd274e16f1d6fc91d25206e2c8e7c251007a814be1b6f0ac8b708844a490ab5175bd8b
|
7
|
+
data.tar.gz: 20486d83d41dc0ea962b9ba4abd4c534f13fd8cf3727530169de1cb65e8307595f9dfce42ade940f2a9d5342d78f20e72e09b4b5d58b208c9d4a3ba89d4ca2df
|
data/lib/mumukit/login.rb
CHANGED
@@ -40,6 +40,7 @@ module Mumukit::Login
|
|
40
40
|
translation_image: ENV['MUMUKI_SAML_TRANSLATION_IMAGE'] || 'image'
|
41
41
|
config.cas = struct url: ENV['MUMUKI_CAS_URL'],
|
42
42
|
host: ENV['MUMUKI_CAS_HOST'],
|
43
|
+
ssl_certificate: ENV['MUMUKI_CAS_SSL_CERTIFICATE'],
|
43
44
|
disable_ssl_verification: ENV['MUMUKI_CAS_DISABLE_SSL_VERIFICATION'] == 'true'
|
44
45
|
config.auth0 = struct client_id: ENV['MUMUKI_AUTH0_CLIENT_ID'],
|
45
46
|
client_secret: ENV['MUMUKI_AUTH0_CLIENT_SECRET'],
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Mumukit::Login::Provider
|
2
2
|
PROVIDERS = %w(
|
3
3
|
developer
|
4
|
+
auth0
|
4
5
|
saml
|
5
6
|
cas
|
6
|
-
auth0
|
7
7
|
google
|
8
8
|
)
|
9
9
|
|
@@ -11,8 +11,10 @@ module Mumukit::Login::Provider
|
|
11
11
|
parse_login_provider(login_provider_string)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# This is a list of the default enabled login providers
|
15
|
+
# It depends only on the current environment
|
16
|
+
def self.default_enabled_providers
|
17
|
+
case ENV['RACK_ENV'] || ENV['RAILS_ENV']
|
16
18
|
when 'production'
|
17
19
|
PROVIDERS - %w(developer)
|
18
20
|
when 'test'
|
@@ -22,17 +24,22 @@ module Mumukit::Login::Provider
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
+
# This is a list of the login providers enabled on the current instance of the platform
|
28
|
+
# It is obtained from the environment, and if unset, it defaults to default_enabled_providers
|
29
|
+
def self.enabled_providers
|
30
|
+
if ENV['MUMUKI_ENABLED_LOGIN_PROVIDERS'].blank?
|
27
31
|
default_enabled_providers
|
28
32
|
else
|
29
33
|
ENV['MUMUKI_ENABLED_LOGIN_PROVIDERS'].split ','
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
33
|
-
|
34
|
-
|
35
|
-
|
37
|
+
# This is the default login provider used when it is not overriden in the organization's config
|
38
|
+
# It is obtained from env, and defaults to the first of the current enabled providers
|
39
|
+
# It should always be a provider within the enabled_providers list
|
40
|
+
def self.login_provider_string
|
41
|
+
if ENV['MUMUKI_LOGIN_PROVIDER'].blank?
|
42
|
+
enabled_providers.first
|
36
43
|
else
|
37
44
|
ENV['MUMUKI_LOGIN_PROVIDER']
|
38
45
|
end
|
@@ -8,10 +8,6 @@ class Mumukit::Login::Provider::Cas < Mumukit::Login::Provider::Base
|
|
8
8
|
def default_settings
|
9
9
|
Mumukit::Login.config.cas
|
10
10
|
end
|
11
|
-
|
12
|
-
def computed_settings(_cas)
|
13
|
-
{ ca_path: '.' }
|
14
|
-
end
|
15
11
|
end
|
16
12
|
|
17
13
|
# Monkey-patching to support phpCAS implementation
|
@@ -31,3 +27,26 @@ module OmniAuth
|
|
31
27
|
end
|
32
28
|
end
|
33
29
|
end
|
30
|
+
|
31
|
+
module OmniAuth
|
32
|
+
module Strategies
|
33
|
+
class CAS
|
34
|
+
class ServiceTicketValidator
|
35
|
+
def get_service_response_body
|
36
|
+
result = ''
|
37
|
+
http = Net::HTTP.new(@uri.host, @uri.port)
|
38
|
+
http.use_ssl = @uri.port == 443 || @uri.instance_of?(URI::HTTPS)
|
39
|
+
if http.use_ssl?
|
40
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @options.disable_ssl_verification?
|
41
|
+
http.cert = @options.ssl_certificate.try { |it| OpenSSL::X509::Certificate.new it }
|
42
|
+
end
|
43
|
+
http.start do |c|
|
44
|
+
response = c.get "#{@uri.path}?#{@uri.query}", VALIDATION_REQUEST_HEADERS.dup
|
45
|
+
result = response.body
|
46
|
+
end
|
47
|
+
result
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-login
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|