gunark-rubycas-server 0.6.99.336
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.txt +1 -0
- data/History.txt +245 -0
- data/LICENSE.txt +504 -0
- data/Manifest.txt +74 -0
- data/PostInstall.txt +3 -0
- data/README.txt +25 -0
- data/Rakefile +4 -0
- data/bin/rubycas-server +26 -0
- data/bin/rubycas-server-ctl +22 -0
- data/config.example.yml +442 -0
- data/config/hoe.rb +76 -0
- data/config/requirements.rb +15 -0
- data/custom_views.example.rb +11 -0
- data/lib/casserver.rb +111 -0
- data/lib/casserver/authenticators/active_directory_ldap.rb +11 -0
- data/lib/casserver/authenticators/base.rb +48 -0
- data/lib/casserver/authenticators/client_certificate.rb +46 -0
- data/lib/casserver/authenticators/ldap.rb +138 -0
- data/lib/casserver/authenticators/ntlm.rb +88 -0
- data/lib/casserver/authenticators/open_id.rb +22 -0
- data/lib/casserver/authenticators/sql.rb +102 -0
- data/lib/casserver/authenticators/sql_encrypted.rb +75 -0
- data/lib/casserver/authenticators/sql_md5.rb +19 -0
- data/lib/casserver/authenticators/test.rb +19 -0
- data/lib/casserver/cas.rb +308 -0
- data/lib/casserver/conf.rb +112 -0
- data/lib/casserver/controllers.rb +452 -0
- data/lib/casserver/environment.rb +26 -0
- data/lib/casserver/models.rb +218 -0
- data/lib/casserver/postambles.rb +174 -0
- data/lib/casserver/utils.rb +30 -0
- data/lib/casserver/version.rb +9 -0
- data/lib/casserver/views.rb +243 -0
- data/lib/rubycas-server.rb +1 -0
- data/lib/rubycas-server/version.rb +1 -0
- data/lib/themes/cas.css +121 -0
- data/lib/themes/notice.png +0 -0
- data/lib/themes/ok.png +0 -0
- data/lib/themes/simple/bg.png +0 -0
- data/lib/themes/simple/login_box_bg.png +0 -0
- data/lib/themes/simple/logo.png +0 -0
- data/lib/themes/simple/theme.css +28 -0
- data/lib/themes/urbacon/bg.png +0 -0
- data/lib/themes/urbacon/login_box_bg.png +0 -0
- data/lib/themes/urbacon/logo.png +0 -0
- data/lib/themes/urbacon/theme.css +33 -0
- data/lib/themes/warning.png +0 -0
- data/misc/basic_cas_single_signon_mechanism_diagram.png +0 -0
- data/misc/basic_cas_single_signon_mechanism_diagram.svg +652 -0
- data/resources/init.d.sh +58 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/vendor/isaac_0.9.1/LICENSE +26 -0
- data/vendor/isaac_0.9.1/README +78 -0
- data/vendor/isaac_0.9.1/TODO +3 -0
- data/vendor/isaac_0.9.1/VERSIONS +3 -0
- data/vendor/isaac_0.9.1/crypt/ISAAC.rb +171 -0
- data/vendor/isaac_0.9.1/isaac.gemspec +39 -0
- data/vendor/isaac_0.9.1/setup.rb +596 -0
- data/vendor/isaac_0.9.1/test/TC_ISAAC.rb +76 -0
- data/website/index.html +40 -0
- data/website/index.txt +3 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.html.erb +40 -0
- metadata +146 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# The #.#.# comments (e.g. "2.1.3") refer to section numbers in the CAS protocol spec
|
|
2
|
+
# under http://www.ja-sig.org/products/cas/overview/protocol/index.html
|
|
3
|
+
|
|
4
|
+
# need auto_validation off to render CAS responses and to use the autocomplete='off' property on password field
|
|
5
|
+
Markaby::Builder.set(:auto_validation, false)
|
|
6
|
+
|
|
7
|
+
# disabled XML indentation because it was causing problems with mod_auth_cas
|
|
8
|
+
#Markaby::Builder.set(:indent, 2)
|
|
9
|
+
|
|
10
|
+
module CASServer::Views
|
|
11
|
+
|
|
12
|
+
def layout
|
|
13
|
+
# wrap as XHTML only when auto_validation is on, otherwise pass right through
|
|
14
|
+
if @use_layout
|
|
15
|
+
xhtml_strict do
|
|
16
|
+
head do
|
|
17
|
+
title { "#{organization} Central Login" }
|
|
18
|
+
link(:rel => "stylesheet", :type => "text/css", :href => "/themes/cas.css")
|
|
19
|
+
link(:rel => "stylesheet", :type => "text/css", :href => "/themes/#{current_theme}/theme.css")
|
|
20
|
+
end
|
|
21
|
+
body(:onload => "if (document.getElementById('username')) document.getElementById('username').focus()") do
|
|
22
|
+
self << yield
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
self << yield
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# 2.1.3
|
|
32
|
+
# The full login page.
|
|
33
|
+
def login
|
|
34
|
+
@use_layout = true
|
|
35
|
+
|
|
36
|
+
table(:id => "login-box") do
|
|
37
|
+
tr do
|
|
38
|
+
td(:colspan => 2) do
|
|
39
|
+
div(:id => "headline-container") do
|
|
40
|
+
strong organization
|
|
41
|
+
text " Central Login"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
if @message
|
|
46
|
+
tr do
|
|
47
|
+
td(:colspan => 2, :id => "messagebox-container") do
|
|
48
|
+
div(:class => "messagebox #{@message[:type]}") { @message[:message] }
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
tr do
|
|
53
|
+
td(:id => "logo-container") do
|
|
54
|
+
img(:id => "logo", :src => "/themes/#{current_theme}/logo.png")
|
|
55
|
+
end
|
|
56
|
+
td(:id => "login-form-container") do
|
|
57
|
+
@include_infoline = true
|
|
58
|
+
login_form
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Just the login form.
|
|
65
|
+
def login_form
|
|
66
|
+
form(:method => "post", :action => @form_action || '/login', :id => "login-form",
|
|
67
|
+
:onsubmit => "submitbutton = document.getElementById('login-submit'); submitbutton.value='Please wait...'; submitbutton.disabled=true; return true;") do
|
|
68
|
+
table(:id => "form-layout") do
|
|
69
|
+
tr do
|
|
70
|
+
td(:id => "username-label-container") do
|
|
71
|
+
label(:id => "username-label", :for => "username") { "Username" }
|
|
72
|
+
end
|
|
73
|
+
td(:id => "username-container") do
|
|
74
|
+
input(:type => "text", :id => "username", :name => "username",
|
|
75
|
+
:size => "32", :tabindex => "1", :accesskey => "u")
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
tr do
|
|
79
|
+
td(:id => "password-label-container") do
|
|
80
|
+
label(:id => "password-label", :for => "password") { "Password" }
|
|
81
|
+
end
|
|
82
|
+
td(:id => "password-container") do
|
|
83
|
+
input(:type => "password", :id => "password", :name => "password",
|
|
84
|
+
:size => "32", :tabindex => "2", :accesskey => "p", :autocomplete => "off")
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
tr do
|
|
88
|
+
td{}
|
|
89
|
+
td(:id => "submit-container") do
|
|
90
|
+
input(:type => "hidden", :id => "lt", :name => "lt", :value => @lt)
|
|
91
|
+
input(:type => "hidden", :id => "service", :name => "service", :value => @service)
|
|
92
|
+
input(:type => "submit", :class => "button", :accesskey => "l", :value => "LOGIN", :tabindex => "4", :id => "login-submit")
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
tr do
|
|
96
|
+
td(:colspan => 2, :id => "infoline") { infoline }
|
|
97
|
+
end if @include_infoline
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# 2.3.2
|
|
103
|
+
def logout
|
|
104
|
+
@use_layout = true
|
|
105
|
+
|
|
106
|
+
table(:id => "login-box") do
|
|
107
|
+
tr do
|
|
108
|
+
td(:colspan => 2) do
|
|
109
|
+
div(:id => "headline-container") do
|
|
110
|
+
strong organization
|
|
111
|
+
text " Central Login"
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
if @message
|
|
116
|
+
tr do
|
|
117
|
+
td(:colspan => 2, :id => "messagebox-container") do
|
|
118
|
+
div(:class => "messagebox #{@message[:type]}") { @message[:message] }
|
|
119
|
+
if @continue_url
|
|
120
|
+
p do
|
|
121
|
+
a(:href => @continue_url) { @continue_url }
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# 2.4.2
|
|
131
|
+
# CAS 1.0 validate response.
|
|
132
|
+
def validate
|
|
133
|
+
if @success
|
|
134
|
+
text "yes\n#{@username}\n"
|
|
135
|
+
else
|
|
136
|
+
text "no\n\n"
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# 2.5.2
|
|
141
|
+
# CAS 2.0 service validate response.
|
|
142
|
+
def service_validate
|
|
143
|
+
if @success
|
|
144
|
+
tag!("cas:serviceResponse", 'xmlns:cas' => "http://www.yale.edu/tp/cas") do
|
|
145
|
+
tag!("cas:authenticationSuccess") do
|
|
146
|
+
tag!("cas:user") {@username.to_s.to_xs}
|
|
147
|
+
@extra_attributes.each do |key, value|
|
|
148
|
+
tag!(key) {serialize_extra_attribute(value)}
|
|
149
|
+
end
|
|
150
|
+
if @pgtiou
|
|
151
|
+
tag!("cas:proxyGrantingTicket") {@pgtiou.to_s.to_xs}
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
else
|
|
156
|
+
tag!("cas:serviceResponse", 'xmlns:cas' => "http://www.yale.edu/tp/cas") do
|
|
157
|
+
tag!("cas:authenticationFailure", :code => @error.code) {@error.to_s.to_xs}
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# 2.6.2
|
|
163
|
+
# CAS 2.0 proxy validate response.
|
|
164
|
+
def proxy_validate
|
|
165
|
+
if @success
|
|
166
|
+
tag!("cas:serviceResponse", 'xmlns:cas' => "http://www.yale.edu/tp/cas") do
|
|
167
|
+
tag!("cas:authenticationSuccess") do
|
|
168
|
+
tag!("cas:user") {@username.to_s.to_xs}
|
|
169
|
+
@extra_attributes.each do |key, value|
|
|
170
|
+
tag!(key) {serialize_extra_attribute(value)}
|
|
171
|
+
end
|
|
172
|
+
if @pgtiou
|
|
173
|
+
tag!("cas:proxyGrantingTicket") {@pgtiou.to_s.to_xs}
|
|
174
|
+
end
|
|
175
|
+
if @proxies && !@proxies.empty?
|
|
176
|
+
tag!("cas:proxies") do
|
|
177
|
+
@proxies.each do |proxy_url|
|
|
178
|
+
tag!("cas:proxy") {proxy_url.to_s.to_xs}
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
else
|
|
185
|
+
tag!("cas:serviceResponse", 'xmlns:cas' => "http://www.yale.edu/tp/cas") do
|
|
186
|
+
tag!("cas:authenticationFailure", :code => @error.code) {@error.to_s.to_xs}
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# 2.7.2
|
|
192
|
+
# CAS 2.0 proxy request response.
|
|
193
|
+
def proxy
|
|
194
|
+
if @success
|
|
195
|
+
tag!("cas:serviceResponse", 'xmlns:cas' => "http://www.yale.edu/tp/cas") do
|
|
196
|
+
tag!("cas:proxySuccess") do
|
|
197
|
+
tag!("cas:proxyTicket") {@pt.to_s.to_xs}
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
else
|
|
201
|
+
tag!("cas:serviceResponse", 'xmlns:cas' => "http://www.yale.edu/tp/cas") do
|
|
202
|
+
tag!("cas:proxyFailure", :code => @error.code) {@error.to_s.to_xs}
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def configure
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
protected
|
|
211
|
+
def themes_dir
|
|
212
|
+
File.dirname(File.expand_path(__FILE__))+'../themes'
|
|
213
|
+
end
|
|
214
|
+
module_function :themes_dir
|
|
215
|
+
|
|
216
|
+
def current_theme
|
|
217
|
+
CASServer::Conf.theme || "simple"
|
|
218
|
+
end
|
|
219
|
+
module_function :current_theme
|
|
220
|
+
|
|
221
|
+
def organization
|
|
222
|
+
CASServer::Conf.organization || ""
|
|
223
|
+
end
|
|
224
|
+
module_function :organization
|
|
225
|
+
|
|
226
|
+
def infoline
|
|
227
|
+
CASServer::Conf.infoline || ""
|
|
228
|
+
end
|
|
229
|
+
module_function :infoline
|
|
230
|
+
|
|
231
|
+
def serialize_extra_attribute(value)
|
|
232
|
+
if value.kind_of?(String) || value.kind_of?(Numeric)
|
|
233
|
+
value
|
|
234
|
+
else
|
|
235
|
+
"<![CDATA[#{value.to_yaml}]]>"
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
module_function :serialize_extra_attribute
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
if CASServer::Conf.custom_views_file
|
|
242
|
+
require CASServer::Conf.custom_views_file
|
|
243
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'lib/casserver'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require File.dirname(__FILE__)+'/../casserver/version.rb'
|
data/lib/themes/cas.css
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
* {
|
|
2
|
+
font-family: Verdana, sans-serif;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
body {
|
|
6
|
+
text-align: center; /* hack for IE */
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
label {
|
|
10
|
+
font-weight: bold;
|
|
11
|
+
font-size: 9px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
input {
|
|
15
|
+
font-weight: normal;
|
|
16
|
+
font-size: 12px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
input.button {
|
|
20
|
+
/*font-weight: bold;*/
|
|
21
|
+
font-size: 10px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#login-box {
|
|
25
|
+
margin: 0 auto;
|
|
26
|
+
width: 350px;
|
|
27
|
+
top: 130px;
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#headline-container {
|
|
32
|
+
text-align: right;
|
|
33
|
+
border-bottom: 1px solid #899989;
|
|
34
|
+
font-family: Tahoma, Verdana, sans-serif;
|
|
35
|
+
font-size: 22px;
|
|
36
|
+
margin-right: 0px;
|
|
37
|
+
padding-right: 7px;
|
|
38
|
+
margin-left: 10px;
|
|
39
|
+
letter-spacing: -0.25px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#logo-container {
|
|
43
|
+
vertical-align: top;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#logo {
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#login-form-container {
|
|
50
|
+
vertical-align: top;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
#username,
|
|
55
|
+
#password {
|
|
56
|
+
width: 10em;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#login-form {
|
|
60
|
+
padding: 20px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
#form-layout {
|
|
65
|
+
position: relative;
|
|
66
|
+
top: 6px;
|
|
67
|
+
width: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#form-layout td {
|
|
71
|
+
text-align: center;
|
|
72
|
+
padding-bottom: 8px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#form-layout td#submit-container {
|
|
76
|
+
text-align: right;
|
|
77
|
+
padding-right: 10px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#infoline {
|
|
81
|
+
font-size: 9px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#messagebox-container {
|
|
85
|
+
padding-left: 11px;
|
|
86
|
+
padding-right: 16px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
div.messagebox {
|
|
90
|
+
font-size: 12px;
|
|
91
|
+
padding: 5px;
|
|
92
|
+
padding-left: 55px;
|
|
93
|
+
text-align: center;
|
|
94
|
+
width: 70%;
|
|
95
|
+
min-height: 34px;
|
|
96
|
+
vertical-align: middle;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
div.mistake {
|
|
100
|
+
color: #d00;
|
|
101
|
+
background-image: url(warning.png);
|
|
102
|
+
background-repeat: no-repeat;
|
|
103
|
+
background-position: 10px 5px;
|
|
104
|
+
font-weight: bold;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
div.confirmation {
|
|
108
|
+
color: #280;
|
|
109
|
+
background-image: url(ok.png);
|
|
110
|
+
background-repeat: no-repeat;
|
|
111
|
+
background-position: 10px 5px;
|
|
112
|
+
font-weight: bold;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
div.notice {
|
|
116
|
+
color: #04c;
|
|
117
|
+
background-image: url(notice.png);
|
|
118
|
+
background-repeat: no-repeat;
|
|
119
|
+
background-position: 10px 5px;
|
|
120
|
+
font-weight: bold;
|
|
121
|
+
}
|
|
Binary file
|
data/lib/themes/ok.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
body {
|
|
2
|
+
background-image: url(bg.png);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
#headline-container {
|
|
6
|
+
margin-bottom: 5px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#login-box {
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
width: 350px;
|
|
12
|
+
top: 110px;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#login-form {
|
|
17
|
+
background-color: #fff;
|
|
18
|
+
border: 1px #aaa solid;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#logo-container {
|
|
22
|
+
vertical-align: middle;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#logo {
|
|
26
|
+
width: 128px;
|
|
27
|
+
height: 128px;
|
|
28
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
body {
|
|
2
|
+
background-image: url(bg.png);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
label {
|
|
6
|
+
color: #5c6156;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#login-form {
|
|
10
|
+
background-repeat: no-repeat;
|
|
11
|
+
background-image: url(login_box_bg.png);
|
|
12
|
+
height: 175px;
|
|
13
|
+
width: 210px;
|
|
14
|
+
padding: 20px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#logo-container {
|
|
18
|
+
vertical-align: top;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#logo {
|
|
22
|
+
width: 115px;
|
|
23
|
+
height: 171px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#infoline {
|
|
27
|
+
color: #5c6156;
|
|
28
|
+
font-size: 8px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#headline-container {
|
|
32
|
+
margin-right: 15px;
|
|
33
|
+
}
|