forked from enterprise-oss/sinatra-ruby-idp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.ru
87 lines (81 loc) · 3.71 KB
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require 'rubygems'
require 'bundler'
Bundler.require
#Ruby function to check directory or file existence
if(File.exist?("config/application.yml"))
puts "loading configuration from config/application.yml"
Figaro.application = Figaro::Application.new(
path: File.expand_path("config/application.yml")
)
Figaro.load
end
require './app'
SamlIdp.configure do |config|
config.x509_certificate = <<-CERT
-----BEGIN CERTIFICATE-----
MIIDtjCCAp4CCQCkrp2ger3dDzANBgkqhkiG9w0BAQsFADCBnDELMAkGA1UEBhMC
VVMxETAPBgNVBAgMCE5ldyBZb3JrMREwDwYDVQQHDAhCcm9va2x5bjEWMBQGA1UE
CgwNRW50ZXJwcmlzZU9TUzENMAsGA1UECwwEZGVtbzEaMBgGA1UEAwwRZW50ZXJw
cmlzZW9zcy5kZXYxJDAiBgkqhkiG9w0BCQEWFXNhbUBlbnRlcnByaXNlb3NzLmRl
djAeFw0yMDEyMDkyMTU5MjVaFw0yMTEyMDkyMTU5MjVaMIGcMQswCQYDVQQGEwJV
UzERMA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCEJyb29rbHluMRYwFAYDVQQK
DA1FbnRlcnByaXNlT1NTMQ0wCwYDVQQLDARkZW1vMRowGAYDVQQDDBFlbnRlcnBy
aXNlb3NzLmRldjEkMCIGCSqGSIb3DQEJARYVc2FtQGVudGVycHJpc2Vvc3MuZGV2
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArAIu2YeGZaEK2AopN9er
mX3iHzkUuwPvnS79VSXVZhjZOwSS4aJl+RGktZj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gQCMTTkJiYcUXzQDrTys7Mxt8DZTomiHIA7q3OPUCKzaiVKg5JTxHrhj
LvPbkF43KLZX2lr5axMd1G4O0lc3omn7zu5ighrEd7Aqyxyjd3+HKNP57fd+Lm/o
s5KE/wRHVCznRNcjx69MmeZLuMHikLvTxYxqJCgSj6StbdI3b6RXpw==
-----END RSA PRIVATE KEY-----
CERT
config.name_id.formats = {
email_address: -> (principal) { principal.email_address },
transient: -> (principal) { principal.id },
persistent: -> (p) { p.id },
}
config.attributes = {
idp_id: {
getter: :id,
},
email: {
getter: :email_address
}
}
end
run MockSamlIdpApp