saml_camel 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -4
- data/app/controllers/concerns/saml_camel/saml_service.rb +17 -12
- data/app/controllers/saml_camel/application_controller.rb +3 -0
- data/app/controllers/saml_camel/saml_controller.rb +47 -29
- data/app/models/saml_camel/application_record.rb +2 -1
- data/app/models/saml_camel/service_provider.rb +99 -71
- data/app/models/saml_camel/shib.rb +7 -12
- data/config/routes.rb +8 -2
- data/config/saml/development/idp_certificate.crt +25 -0
- data/config/saml/development/saml_certificate.crt +28 -0
- data/config/saml/development/saml_key.key +27 -0
- data/config/saml/development/settings.json +36 -0
- data/config/saml/production/idp_certificate.crt +25 -0
- data/config/saml/production/saml_certificate.crt +28 -0
- data/config/saml/production/saml_key.key +27 -0
- data/config/saml/production/settings.json +1 -0
- data/config/saml/test/idp_certificate.crt +25 -0
- data/config/saml/test/saml_certificate.crt +28 -0
- data/config/saml/test/saml_key.key +27 -0
- data/config/saml/test/settings.json +36 -0
- data/lib/saml_camel/engine.rb +3 -3
- data/lib/saml_camel/version.rb +3 -1
- data/lib/saml_camel.rb +81 -53
- data/lib/tasks/saml_camel_tasks.rake +73 -73
- metadata +33 -7
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"_comment": "note you will need to restart the application when you make changes to this file",
|
3
|
+
"settings": {
|
4
|
+
"acs": "http://localhost:3000/saml/consumeSaml",
|
5
|
+
"raw_response_acs": "http://localhost:3000/saml/consumeSaml/rawResponse",
|
6
|
+
"entity_id": "https://dummycamel.com",
|
7
|
+
"sso_url": "https://shib.oit.duke.edu/idp/profile/SAML2/Redirect/SSO",
|
8
|
+
"logout_url": "https://shib.oit.duke.edu/cgi-bin/logout.pl",
|
9
|
+
"primary_id": "eduPersonPrincipalName",
|
10
|
+
"sp_session_timeout": 1,
|
11
|
+
"sp_session_lifetime": 8,
|
12
|
+
"test_auth_path": true,
|
13
|
+
"saml_logging": true,
|
14
|
+
"debug": false
|
15
|
+
},
|
16
|
+
"attribute_map": {
|
17
|
+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.9": "eduPersonScopedAffiliation",
|
18
|
+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.6": "eduPersonPrincipalName",
|
19
|
+
"urn:oid:2.5.4.3": "cn",
|
20
|
+
"urn:oid:0.9.2342.19200300.100.1.1": "uid",
|
21
|
+
"urn:oid:0.9.2342.19200300.100.1.3": "mail",
|
22
|
+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.5": "eduPersonPrimaryAffiliation",
|
23
|
+
"urn:oid:2.16.840.1.113730.3.1.241": "displayName",
|
24
|
+
"urn:mace:duke.edu:idms:unique-id": "duDukeID",
|
25
|
+
"urn:mace:duke.edu:idms:dku-id": "dku-id",
|
26
|
+
"urn:oid:1.3.6.1.4.1.5923.1.5.1.1": "isMemberOf",
|
27
|
+
"urn:oid:2.5.4.42": "givenName",
|
28
|
+
"urn:oid:2.5.4.4": "sn",
|
29
|
+
"urn:oid:2.5.4.11": "ou",
|
30
|
+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.1": "eduPersonAffiliation",
|
31
|
+
"urn:oid:2.5.4.20": "telephoneNumber",
|
32
|
+
"urn:oid:2.5.4.12": "title",
|
33
|
+
"urn:mace:duke.edu:idms:middle-name1": "duMiddleName1",
|
34
|
+
"urn:mace:duke.edu:idms:proxy-token": "duProxyToken"
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
MIIEWjCCA0KgAwIBAgIJAP1rB/FjRgy6MA0GCSqGSIb3DQEBBQUAMHsxCzAJBgNV
|
2
|
+
BAYTAlVTMRcwFQYDVQQIEw5Ob3J0aCBDYXJvbGluYTEPMA0GA1UEBxMGRHVyaGFt
|
3
|
+
MRgwFgYDVQQKEw9EdWtlIFVuaXZlcnNpdHkxDDAKBgNVBAsTA09JVDEaMBgGA1UE
|
4
|
+
AxMRc2hpYi5vaXQuZHVrZS5lZHUwHhcNMTA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RMziTAi79yP2rLqE7cMKPDtrOilHK8fDk5N2xxzEsVoKUsotq
|
14
|
+
x384sfmrA3oVSNQsPi/DF16eH1cLaQL86rTaUKl4DqO6rLBPhQVjrmuwdWgnKKGn
|
15
|
+
9XMEp8lBC7KwAnaQKP7c83WarU/FbF08BbPkHob1wuAyMrD7wRv2XDcCgYEAxnl8
|
16
|
+
SuHwIooIyiW2/oDjoqCrdtgOLXzdOK2OSDcY+jARVkOA8N0ingPOb18RLOTmjGk5
|
17
|
+
KZDHa8xZzdd0Bt7xz3WV2FipYxnkkY7sJosJpMrY8k/QUip9i2D04uLypwVBfT7P
|
18
|
+
q3GOgOrP+nvRya8HLHKm0rf7+sU2mGIsSrVYtI0CgYBzQUIoL5FPW0e4XQFG/FJx
|
19
|
+
29NcBQk1DMsq8CB2KnZSvhS35st3O+rDIE4/vKrLDVRmS9UkuUcJ+VaKHler0s2A
|
20
|
+
a8iKT7GoHt2YNZKFSEzVKJ1R6cVLXvUJZihvsSivGBd6cLuzplWgwEQS2gBBsWJ6
|
21
|
+
w1CLzpYwHyU1jtIUmtAV7QKBgCtC3bnAx8PvjHzrfZi55WRUWyt7apO1rM6m3eWV
|
22
|
+
xOb7xTulWRynRt1kfQG/mhHMDwi6AtCxkxZHI6f/d3Xr8I9E1RWkNb+5LB4iJg08
|
23
|
+
ryxxXppqlUDjrBvOVXKC/1syhRTUtRVsmiA1joHNrWulsA2bLAuwOMdvZzgN5hOe
|
24
|
+
tagdAoGAP7kdbprmkT/7xX8puX6WD4MXQ+dgyb3FvpCIfQT8x0t/ndMI2wMc4keg
|
25
|
+
woD2L56tjtVyFH8LQz1sU7LroSc8XF2joZOdQePrnyTVUISoMiTqaXMPIO6l6pez
|
26
|
+
x7g1PP3ey5LOoX7LG5ule/6qNMtRhVOFok0vA9ZuuIIkkmYSo1c=
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1 @@
|
|
1
|
+
{"_comment":"note you will need to restart the application when you make changes to this file","settings":{"acs":"http://localhost:3000/saml/consumeSaml","raw_response_acs":"http://localhost:3000/saml/consumeSaml/rawResponse","entity_id":"https://your-entity-id.com","sso_url":"https://shib.oit.duke.edu/idp/profile/SAML2/Redirect/SSO","logout_url":"https://shib.oit.duke.edu/cgi-bin/logout.pl","primary_id":"eduPersonPrincipalName","sp_session_timeout":1,"sp_session_lifetime":8,"saml_logging":true,"debug":false},"attribute_map":{"urn:oid:1.3.6.1.4.1.5923.1.1.1.9":"eduPersonScopedAffiliation","urn:oid:1.3.6.1.4.1.5923.1.1.1.6":"eduPersonPrincipalName","urn:oid:2.5.4.3":"cn","urn:oid:0.9.2342.19200300.100.1.1":"uid","urn:oid:0.9.2342.19200300.100.1.3":"mail","urn:oid:1.3.6.1.4.1.5923.1.1.1.5":"eduPersonPrimaryAffiliation","urn:oid:2.16.840.1.113730.3.1.241":"displayName","urn:mace:duke.edu:idms:unique-id":"duDukeID","urn:mace:duke.edu:idms:dku-id":"dku-id","urn:oid:1.3.6.1.4.1.5923.1.5.1.1":"isMemberOf","urn:oid:2.5.4.42":"givenName","urn:oid:2.5.4.4":"sn","urn:oid:2.5.4.11":"ou","urn:oid:1.3.6.1.4.1.5923.1.1.1.1":"eduPersonAffiliation","urn:oid:2.5.4.20":"telephoneNumber","urn:oid:2.5.4.12":"title","urn:mace:duke.edu:idms:middle-name1":"duMiddleName1","urn:mace:duke.edu:idms:proxy-token":"duProxyToken"}}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
MIIEWjCCA0KgAwIBAgIJAP1rB/FjRgy6MA0GCSqGSIb3DQEBBQUAMHsxCzAJBgNV
|
2
|
+
BAYTAlVTMRcwFQYDVQQIEw5Ob3J0aCBDYXJvbGluYTEPMA0GA1UEBxMGRHVyaGFt
|
3
|
+
MRgwFgYDVQQKEw9EdWtlIFVuaXZlcnNpdHkxDDAKBgNVBAsTA09JVDEaMBgGA1UE
|
4
|
+
AxMRc2hpYi5vaXQuZHVrZS5lZHUwHhcNMTAwOTA5MTI0N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rLqE7cMKPDtrOilHK8fDk5N2xxzEsVoKUsotq
|
14
|
+
x384sfmrA3oVSNQsPi/DF16eH1cLaQL86rTaUKl4DqO6rLBPhQVjrmuwdWgnKKGn
|
15
|
+
9XMEp8lBC7KwAnaQKP7c83WarU/FbF08BbPkHob1wuAyMrD7wRv2XDcCgYEAxnl8
|
16
|
+
SuHwIooIyiW2/oDjoqCrdtgOLXzdOK2OSDcY+jARVkOA8N0ingPOb18RLOTmjGk5
|
17
|
+
KZDHa8xZzdd0Bt7xz3WV2FipYxnkkY7sJosJpMrY8k/QUip9i2D04uLypwVBfT7P
|
18
|
+
q3GOgOrP+nvRya8HLHKm0rf7+sU2mGIsSrVYtI0CgYBzQUIoL5FPW0e4XQFG/FJx
|
19
|
+
29NcBQk1DMsq8CB2KnZSvhS35st3O+rDIE4/vKrLDVRmS9UkuUcJ+VaKHler0s2A
|
20
|
+
a8iKT7GoHt2YNZKFSEzVKJ1R6cVLXvUJZihvsSivGBd6cLuzplWgwEQS2gBBsWJ6
|
21
|
+
w1CLzpYwHyU1jtIUmtAV7QKBgCtC3bnAx8PvjHzrfZi55WRUWyt7apO1rM6m3eWV
|
22
|
+
xOb7xTulWRynRt1kfQG/mhHMDwi6AtCxkxZHI6f/d3Xr8I9E1RWkNb+5LB4iJg08
|
23
|
+
ryxxXppqlUDjrBvOVXKC/1syhRTUtRVsmiA1joHNrWulsA2bLAuwOMdvZzgN5hOe
|
24
|
+
tagdAoGAP7kdbprmkT/7xX8puX6WD4MXQ+dgyb3FvpCIfQT8x0t/ndMI2wMc4keg
|
25
|
+
woD2L56tjtVyFH8LQz1sU7LroSc8XF2joZOdQePrnyTVUISoMiTqaXMPIO6l6pez
|
26
|
+
x7g1PP3ey5LOoX7LG5ule/6qNMtRhVOFok0vA9ZuuIIkkmYSo1c=
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"_comment": "note you will need to restart the application when you make changes to this file",
|
3
|
+
"settings": {
|
4
|
+
"acs": "http://localhost:3000/saml/consumeSaml",
|
5
|
+
"raw_response_acs": "http://localhost:3000/saml/consumeSaml/rawResponse",
|
6
|
+
"entity_id": "https://dummycamel.com",
|
7
|
+
"sso_url": "https://shib.oit.duke.edu/idp/profile/SAML2/Redirect/SSO",
|
8
|
+
"logout_url": "https://shib.oit.duke.edu/cgi-bin/logout.pl",
|
9
|
+
"primary_id": "eduPersonPrincipalName",
|
10
|
+
"sp_session_timeout": 1,
|
11
|
+
"sp_session_lifetime": 8,
|
12
|
+
"test_auth_path": true,
|
13
|
+
"saml_logging": true,
|
14
|
+
"debug": false
|
15
|
+
},
|
16
|
+
"attribute_map": {
|
17
|
+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.9": "eduPersonScopedAffiliation",
|
18
|
+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.6": "eduPersonPrincipalName",
|
19
|
+
"urn:oid:2.5.4.3": "cn",
|
20
|
+
"urn:oid:0.9.2342.19200300.100.1.1": "uid",
|
21
|
+
"urn:oid:0.9.2342.19200300.100.1.3": "mail",
|
22
|
+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.5": "eduPersonPrimaryAffiliation",
|
23
|
+
"urn:oid:2.16.840.1.113730.3.1.241": "displayName",
|
24
|
+
"urn:mace:duke.edu:idms:unique-id": "duDukeID",
|
25
|
+
"urn:mace:duke.edu:idms:dku-id": "dku-id",
|
26
|
+
"urn:oid:1.3.6.1.4.1.5923.1.5.1.1": "isMemberOf",
|
27
|
+
"urn:oid:2.5.4.42": "givenName",
|
28
|
+
"urn:oid:2.5.4.4": "sn",
|
29
|
+
"urn:oid:2.5.4.11": "ou",
|
30
|
+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.1": "eduPersonAffiliation",
|
31
|
+
"urn:oid:2.5.4.20": "telephoneNumber",
|
32
|
+
"urn:oid:2.5.4.12": "title",
|
33
|
+
"urn:mace:duke.edu:idms:middle-name1": "duMiddleName1",
|
34
|
+
"urn:mace:duke.edu:idms:proxy-token": "duProxyToken"
|
35
|
+
}
|
36
|
+
}
|
data/lib/saml_camel/engine.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
4
|
require 'onelogin/ruby-saml'
|
3
|
-
|
4
5
|
module SamlCamel
|
6
|
+
# engine definition
|
5
7
|
class Engine < ::Rails::Engine
|
6
8
|
isolate_namespace SamlCamel
|
7
|
-
|
8
9
|
config.to_prepare do
|
9
10
|
ActionController::Base.include SamlCamel::SamlService
|
10
11
|
end
|
11
|
-
|
12
12
|
end
|
13
13
|
end
|
data/lib/saml_camel/version.rb
CHANGED
data/lib/saml_camel.rb
CHANGED
@@ -1,41 +1,49 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'saml_camel/engine'
|
4
|
+
|
5
|
+
# main logic for non initialized SAML camel methods
|
3
6
|
module SamlCamel
|
4
7
|
begin
|
5
8
|
SP_SETTINGS = JSON.parse(File.read("config/saml/#{Rails.env}/settings.json"))
|
6
|
-
|
7
|
-
|
9
|
+
SP_DEBUG = SP_SETTINGS['settings']['debug']
|
10
|
+
rescue StandardError # rubocop:disable Lint/HandleExceptions
|
11
|
+
# rescue othewise the generator fails
|
8
12
|
end
|
9
13
|
|
10
|
-
|
14
|
+
# builds saml requests and decrypts saml responses
|
11
15
|
module Transaction
|
12
16
|
begin
|
13
17
|
IDP_CERT = File.read("config/saml/#{Rails.env}/idp_certificate.crt")
|
14
18
|
SP_CERT = File.read("config/saml/#{Rails.env}/saml_certificate.crt")
|
15
19
|
SP_KEY = File.read("config/saml/#{Rails.env}/saml_key.key")
|
16
|
-
rescue
|
17
|
-
#rescue othewise the generator fails
|
20
|
+
rescue StandardError # rubocop:disable Lint/HandleExceptions
|
21
|
+
# rescue othewise the generator fails
|
18
22
|
end
|
19
23
|
|
20
24
|
def self.map_attributes(sp_attributes)
|
21
|
-
attr_map = SP_SETTINGS[
|
25
|
+
attr_map = SP_SETTINGS['attribute_map']
|
22
26
|
mapped_attributes = {}
|
23
27
|
|
24
|
-
sp_attributes.each do |sp_attribute,value|
|
28
|
+
sp_attributes.each do |sp_attribute, value|
|
25
29
|
sp_attribute = attr_map[sp_attribute] || value
|
26
30
|
mapped_attributes[sp_attribute] = value
|
27
31
|
end
|
28
32
|
mapped_attributes
|
29
33
|
end
|
30
34
|
|
31
|
-
def self.saml_settings
|
32
|
-
sp_settings = SP_SETTINGS[
|
35
|
+
def self.saml_settings(raw_response: false)
|
36
|
+
sp_settings = SP_SETTINGS['settings']
|
33
37
|
|
34
38
|
settings = OneLogin::RubySaml::Settings.new
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
if raw_response
|
40
|
+
settings.assertion_consumer_service_url = sp_settings['raw_response_acs']
|
41
|
+
settings.force_authn = '1'
|
42
|
+
else
|
43
|
+
settings.assertion_consumer_service_url = sp_settings['acs']
|
44
|
+
end
|
45
|
+
settings.issuer = sp_settings['entity_id']
|
46
|
+
settings.idp_sso_target_url = sp_settings['sso_url']
|
39
47
|
|
40
48
|
# certificate to register with IDP and key to decrypt
|
41
49
|
settings.certificate = SP_CERT
|
@@ -46,57 +54,77 @@ module SamlCamel
|
|
46
54
|
# certificate to verify IDP signature
|
47
55
|
settings.idp_cert = IDP_CERT
|
48
56
|
|
57
|
+
# inidcates SP wants assertions to be signed
|
58
|
+
settings.security[:want_responses_signed] = true
|
59
|
+
|
49
60
|
settings
|
50
61
|
end
|
51
62
|
end
|
52
63
|
|
53
|
-
|
64
|
+
# handles logging throughout SP
|
54
65
|
module Logging
|
55
66
|
begin
|
56
|
-
PRIMARY_ID = SP_SETTINGS[
|
57
|
-
SHOULD_LOG = SP_SETTINGS[
|
58
|
-
LOGGER = Logger.new(
|
59
|
-
rescue
|
60
|
-
#rescue othewise the generator fails
|
67
|
+
PRIMARY_ID = SP_SETTINGS['settings']['primary_id']
|
68
|
+
SHOULD_LOG = SP_SETTINGS['settings']['saml_logging']
|
69
|
+
LOGGER = Logger.new('log/saml.log')
|
70
|
+
rescue StandardError # rubocop:disable Lint/HandleExceptions
|
71
|
+
# rescue othewise the generator fails
|
61
72
|
end
|
62
73
|
|
74
|
+
def self.auth_failure(error_context)
|
75
|
+
LOGGER.error("An error occured during authentication. #{error_context}") if SHOULD_LOG
|
76
|
+
LOGGER.error("Backtrace: \n\t\t#{error_context.backtrace.join("\n\t\t")}") if SHOULD_LOG
|
77
|
+
rescue StandardError
|
78
|
+
LOGGER.debug('Unknown Error During auth_failure logging.') if SHOULD_LOG
|
79
|
+
end
|
63
80
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
81
|
+
def self.bad_ip(saml_attrs, request_ip, current_ip)
|
82
|
+
if SHOULD_LOG
|
83
|
+
LOGGER.info("Bad IP address for #{saml_attrs[PRIMARY_ID]}. IP at SAML
|
84
|
+
request #{request_ip} | IP presented #{current_ip}")
|
85
|
+
end
|
86
|
+
rescue StandardError
|
87
|
+
LOGGER.debug('Unknown Error During relay state logging. IP check') if SHOULD_LOG
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.debug(message)
|
91
|
+
LOGGER.debug(message) if SHOULD_LOG
|
92
|
+
rescue StandardError
|
93
|
+
LOGGER.debug('Unknown Error During Debug') if SHOULD_LOG
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.expired_session(saml_attrs)
|
97
|
+
LOGGER.info("Session Expired for #{saml_attrs[PRIMARY_ID]}") if SHOULD_LOG
|
98
|
+
rescue StandardError
|
99
|
+
LOGGER.debug('Unknown Error During relay state logging. Expired session check') if SHOULD_LOG
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.logout(saml_attrs)
|
103
|
+
LOGGER.info("#{saml_attrs[PRIMARY_ID]} has succesfully logged out.") if SHOULD_LOG
|
104
|
+
rescue StandardError
|
105
|
+
if SHOULD_LOG
|
106
|
+
LOGGER.debug('Unknown error logging user logout.
|
107
|
+
Most likely anonymous user clicked a logout button.')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.saml_state(data)
|
112
|
+
if SHOULD_LOG
|
113
|
+
LOGGER.info("Stored Relay: #{data[:stored_relay]} |
|
114
|
+
RequestRelay: #{data[:request_relay]} |
|
115
|
+
Stored IP: #{data[:stored_ip]} RemoteIP: #{data[:remote_ip]}")
|
116
|
+
end
|
117
|
+
rescue StandardError
|
118
|
+
LOGGER.debug('Unknown Error During relay state logging. Saml state check') if SHOULD_LOG
|
119
|
+
end
|
94
120
|
|
95
121
|
def self.successful_auth(saml_attrs)
|
96
122
|
LOGGER.info("#{saml_attrs[PRIMARY_ID]} has succesfully authenticated.") if SHOULD_LOG
|
97
|
-
rescue
|
98
|
-
|
123
|
+
rescue StandardError
|
124
|
+
if SHOULD_LOG
|
125
|
+
LOGGER.debug('Unknown Error During successful_auth logging.
|
126
|
+
Check PRIMARY_ID configured in settings.json and that user has attribute.')
|
127
|
+
end
|
99
128
|
end
|
100
129
|
end
|
101
|
-
|
102
130
|
end
|