kennedy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/.yardoc +0 -0
- data/LICENSE +20 -0
- data/MAIN.rdoc +23 -0
- data/README.markdown +17 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/bin/kennedy-gen +13 -0
- data/doc/Kennedy.html +98 -0
- data/doc/Kennedy/Backends.html +94 -0
- data/doc/Kennedy/Backends/LDAP.html +471 -0
- data/doc/Kennedy/BadTicketException.html +92 -0
- data/doc/Kennedy/Granter.html +570 -0
- data/doc/Kennedy/Server.html +258 -0
- data/doc/Kennedy/Ticket.html +875 -0
- data/doc/_index.html +170 -0
- data/doc/class_list.html +97 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +23 -0
- data/doc/css/style.css +261 -0
- data/doc/file.README.html +69 -0
- data/doc/file_list.html +29 -0
- data/doc/index.html +69 -0
- data/doc/js/app.js +91 -0
- data/doc/js/full_list.js +39 -0
- data/doc/js/jquery.js +19 -0
- data/doc/method_list.html +152 -0
- data/doc/top-level-namespace.html +80 -0
- data/kennedy.gemspec +114 -0
- data/lib/kennedy.rb +2 -0
- data/lib/kennedy/backends/ldap.rb +35 -0
- data/lib/kennedy/generator.rb +69 -0
- data/lib/kennedy/granter.rb +52 -0
- data/lib/kennedy/instance_configuration.rb +58 -0
- data/lib/kennedy/server.rb +164 -0
- data/lib/kennedy/ticket.rb +97 -0
- data/logo.png +0 -0
- data/template/config.ru.erb +22 -0
- data/template/config/api_keys.yml.erb +1 -0
- data/template/config/backend.rb +0 -0
- data/template/config/encryption.yml.erb +2 -0
- data/template/config/sessions.yml.erb +1 -0
- data/test/granter_test.rb +93 -0
- data/test/ldap_backend_test.rb +66 -0
- data/test/server_test.rb +285 -0
- data/test/teststrap.rb +34 -0
- data/test/ticket_test.rb +84 -0
- metadata +177 -0
data/.document
ADDED
data/.gitignore
ADDED
data/.yardoc
ADDED
Binary file
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 gabrielg
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/MAIN.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
<p><img src='http://github.com/gabrielg/kennedy/raw/master/logo.png' alt='Kennedy' /></p>
|
2
|
+
|
3
|
+
<h2 id='description'>Description</h2>
|
4
|
+
|
5
|
+
<p>Kennedy is both an SSO server and client library.</p>
|
6
|
+
|
7
|
+
<h2 id='note_on_patchespull_requests'>Note on Patches/Pull Requests</h2>
|
8
|
+
|
9
|
+
<ul>
|
10
|
+
<li>Fork the project.</li>
|
11
|
+
|
12
|
+
<li>Make your feature addition or bug fix.</li>
|
13
|
+
|
14
|
+
<li>Add tests for it. This is important so I don’t break it in a future version unintentionally.</li>
|
15
|
+
|
16
|
+
<li>Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)</li>
|
17
|
+
|
18
|
+
<li>Send me a pull request. Bonus points for topic branches.</li>
|
19
|
+
</ul>
|
20
|
+
|
21
|
+
<h2 id='copyright'>Copyright</h2>
|
22
|
+
|
23
|
+
<p>Copyright (c) 2009 gabrielg. See LICENSE for details.</p>
|
data/README.markdown
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
![Kennedy](http://github.com/gabrielg/kennedy/raw/master/logo.png)
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
Kennedy is both an SSO server and client library.
|
6
|
+
|
7
|
+
## Note on Patches/Pull Requests
|
8
|
+
|
9
|
+
* Fork the project.
|
10
|
+
* Make your feature addition or bug fix.
|
11
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
12
|
+
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
## Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2009 gabrielg. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.executables << "kennedy-gen"
|
8
|
+
gem.name = "kennedy"
|
9
|
+
gem.summary = %Q{A simple single-sign-on client and server library.}
|
10
|
+
gem.description = %Q{Kennedy is out for Castronaut. A simple single-sign-on client and server library.}
|
11
|
+
gem.email = "gabriel.gironda@gmail.com"
|
12
|
+
gem.homepage = "http://github.com/gabrielg/kennedy"
|
13
|
+
gem.authors = ["gabrielg"]
|
14
|
+
gem.add_development_dependency "riot", ">= 0"
|
15
|
+
gem.add_development_dependency "maruku"
|
16
|
+
gem.add_development_dependency "yard"
|
17
|
+
gem.add_dependency "ruby-net-ldap"
|
18
|
+
gem.add_dependency "json"
|
19
|
+
gem.add_dependency "sinatra"
|
20
|
+
gem.add_dependency "rack"
|
21
|
+
end
|
22
|
+
Jeweler::GemcutterTasks.new
|
23
|
+
rescue LoadError
|
24
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
Rake::TestTask.new(:test) do |test|
|
29
|
+
test.libs << 'lib' << 'test'
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :test => :check_dependencies
|
35
|
+
|
36
|
+
task :default => :test
|
37
|
+
|
38
|
+
task :generate_main_rdoc do
|
39
|
+
require 'maruku'
|
40
|
+
content = File.read('README.markdown')
|
41
|
+
doc = Maruku.new(content)
|
42
|
+
File.open(File.join(File.dirname(__FILE__), 'MAIN.rdoc'), 'w') { |f| f << doc.to_html }
|
43
|
+
end
|
44
|
+
|
45
|
+
begin
|
46
|
+
require 'yard'
|
47
|
+
YARD::Rake::YardocTask.new(:yard => :generate_main_rdoc)
|
48
|
+
rescue LoadError
|
49
|
+
task :yardoc do
|
50
|
+
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
51
|
+
end
|
52
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/kennedy-gen
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
$: << (Pathname(__FILE__).parent.parent + "lib").expand_path.to_s
|
4
|
+
|
5
|
+
require 'kennedy/generator'
|
6
|
+
generator = Kennedy::Generator.new
|
7
|
+
begin
|
8
|
+
generator.run(ARGV)
|
9
|
+
exit 0
|
10
|
+
rescue => e
|
11
|
+
puts e.inspect
|
12
|
+
exit 1
|
13
|
+
end
|
data/doc/Kennedy.html
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta name="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>Module: Kennedy</title>
|
7
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div id="header">
|
20
|
+
<div id="menu">
|
21
|
+
|
22
|
+
<a href="_index.html">Index (K)</a> »
|
23
|
+
|
24
|
+
|
25
|
+
<span class="title">Kennedy</span>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="search">
|
30
|
+
<a id="class_list_link" href="#">Namespace List</a>
|
31
|
+
<a id="method_list_link" href="#">Method List</a>
|
32
|
+
<a id ="file_list_link" href="#">File List</a>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="clear"></div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<iframe id="search_frame"></iframe>
|
39
|
+
|
40
|
+
<div id="content"><h1>Module: Kennedy
|
41
|
+
|
42
|
+
|
43
|
+
</h1>
|
44
|
+
|
45
|
+
<dl class="box">
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
<dt class="r1 last">Defined in:</dt>
|
54
|
+
<dd class="r1 last">lib/kennedy/server.rb<span class="defines">,<br />
|
55
|
+
lib/kennedy/ticket.rb,<br /> lib/kennedy/granter.rb,<br /> lib/kennedy/backends/ldap.rb</span>
|
56
|
+
</dd>
|
57
|
+
|
58
|
+
</dl>
|
59
|
+
<div class="clear"></div>
|
60
|
+
|
61
|
+
<h2>Overview</h2><div class="docstring">
|
62
|
+
<div class="discussion">
|
63
|
+
<p>
|
64
|
+
Kennedy
|
65
|
+
</p>
|
66
|
+
|
67
|
+
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
<div class="tags">
|
71
|
+
|
72
|
+
</div><h2>Defined Under Namespace</h2>
|
73
|
+
<p class="children">
|
74
|
+
|
75
|
+
|
76
|
+
<strong class="modules">Modules:</strong> <a title="Backends" href="Kennedy/Backends.html">Backends</a>
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
<strong class="classes">Classes:</strong> <a title="BadTicketException" href="Kennedy/BadTicketException.html">BadTicketException</a>, <a title="Granter" href="Kennedy/Granter.html">Granter</a>, <a title="Server" href="Kennedy/Server.html">Server</a>, <a title="Ticket" href="Kennedy/Ticket.html">Ticket</a>
|
81
|
+
|
82
|
+
|
83
|
+
</p>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="footer">
|
92
|
+
Generated on Tue Dec 8 16:39:39 2009 by
|
93
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
94
|
+
0.4.0 (ruby-1.8.7).
|
95
|
+
</div>
|
96
|
+
|
97
|
+
</body>
|
98
|
+
</html>
|
@@ -0,0 +1,94 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta name="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>Module: Kennedy::Backends</title>
|
7
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div id="header">
|
20
|
+
<div id="menu">
|
21
|
+
|
22
|
+
<a href="../_index.html">Index (B)</a> »
|
23
|
+
<a title="Kennedy" href="../Kennedy.html">Kennedy</a>
|
24
|
+
»
|
25
|
+
<span class="title">Backends</span>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="search">
|
30
|
+
<a id="class_list_link" href="#">Namespace List</a>
|
31
|
+
<a id="method_list_link" href="#">Method List</a>
|
32
|
+
<a id ="file_list_link" href="#">File List</a>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="clear"></div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<iframe id="search_frame"></iframe>
|
39
|
+
|
40
|
+
<div id="content"><h1>Module: Kennedy::Backends
|
41
|
+
|
42
|
+
|
43
|
+
</h1>
|
44
|
+
|
45
|
+
<dl class="box">
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
<dt class="r1 last">Defined in:</dt>
|
54
|
+
<dd class="r1 last">lib/kennedy/backends/ldap.rb</dd>
|
55
|
+
|
56
|
+
</dl>
|
57
|
+
<div class="clear"></div>
|
58
|
+
|
59
|
+
<h2>Overview</h2><div class="docstring">
|
60
|
+
<div class="discussion">
|
61
|
+
<p>
|
62
|
+
Backends
|
63
|
+
</p>
|
64
|
+
|
65
|
+
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
<div class="tags">
|
69
|
+
|
70
|
+
</div><h2>Defined Under Namespace</h2>
|
71
|
+
<p class="children">
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
<strong class="classes">Classes:</strong> <a title="LDAP" href="Backends/LDAP.html">LDAP</a>
|
77
|
+
|
78
|
+
|
79
|
+
</p>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div id="footer">
|
88
|
+
Generated on Tue Dec 8 16:39:38 2009 by
|
89
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
90
|
+
0.4.0 (ruby-1.8.7).
|
91
|
+
</div>
|
92
|
+
|
93
|
+
</body>
|
94
|
+
</html>
|
@@ -0,0 +1,471 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta name="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>Class: Kennedy::Backends::LDAP</title>
|
7
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '../..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div id="header">
|
20
|
+
<div id="menu">
|
21
|
+
|
22
|
+
<a href="../../_index.html">Index (L)</a> »
|
23
|
+
<a title="Kennedy" href="../../Kennedy.html">Kennedy</a> » <a title="Backends" href="../Backends.html">Backends</a>
|
24
|
+
»
|
25
|
+
<span class="title">LDAP</span>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="search">
|
30
|
+
<a id="class_list_link" href="#">Namespace List</a>
|
31
|
+
<a id="method_list_link" href="#">Method List</a>
|
32
|
+
<a id ="file_list_link" href="#">File List</a>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="clear"></div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<iframe id="search_frame"></iframe>
|
39
|
+
|
40
|
+
<div id="content"><h1>Class: Kennedy::Backends::LDAP
|
41
|
+
|
42
|
+
|
43
|
+
</h1>
|
44
|
+
|
45
|
+
<dl class="box">
|
46
|
+
|
47
|
+
<dt class="r1">Inherits:</dt>
|
48
|
+
<dd class="r1">
|
49
|
+
<span class="inheritName">Object</span>
|
50
|
+
|
51
|
+
</dd>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<dt class="r2 last">Defined in:</dt>
|
61
|
+
<dd class="r2 last">lib/kennedy/backends/ldap.rb</dd>
|
62
|
+
|
63
|
+
</dl>
|
64
|
+
<div class="clear"></div>
|
65
|
+
|
66
|
+
<h2>Overview</h2><div class="docstring">
|
67
|
+
<div class="discussion">
|
68
|
+
<p>
|
69
|
+
LDAP
|
70
|
+
</p>
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
<div class="tags">
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<h2>Attribute Summary</h2>
|
80
|
+
<ul class="summary">
|
81
|
+
|
82
|
+
<li class="public ">
|
83
|
+
<span class="summary_signature"><a title="#filter= (instance method)" href="#filter%3D-instance_method">- (Object) <strong>filter=</strong> </a>
|
84
|
+
|
85
|
+
</span>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<span class="summary_desc">
|
93
|
+
Sets the attribute <tt>filter</tt>.
|
94
|
+
|
95
|
+
</span>
|
96
|
+
|
97
|
+
</li>
|
98
|
+
|
99
|
+
|
100
|
+
</ul>
|
101
|
+
|
102
|
+
|
103
|
+
<h2>Method Summary</h2>
|
104
|
+
<ul class="summary">
|
105
|
+
|
106
|
+
<li class="public ">
|
107
|
+
<span class="summary_signature"><a title="#authenticate (instance method)" href="#authenticate-instance_method">- (true) <strong>authenticate</strong>(identifier, password) </a>
|
108
|
+
|
109
|
+
</span>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<span class="summary_desc">
|
117
|
+
Authenticates the given credentials against LDAP.
|
118
|
+
|
119
|
+
</span>
|
120
|
+
|
121
|
+
</li>
|
122
|
+
|
123
|
+
|
124
|
+
<li class="public ">
|
125
|
+
<span class="summary_signature"><a title="#initialize (instance method)" href="#initialize-instance_method">- (LDAP) <strong>initialize</strong>(args = {}) </a>
|
126
|
+
|
127
|
+
</span>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="summary_desc">
|
135
|
+
Creates a new LDAP auth backend with the given arguments.
|
136
|
+
|
137
|
+
</span>
|
138
|
+
|
139
|
+
</li>
|
140
|
+
|
141
|
+
|
142
|
+
</ul>
|
143
|
+
|
144
|
+
<div id="constructor_details">
|
145
|
+
<h2>Constructor Details</h2>
|
146
|
+
|
147
|
+
<div class="method_details first">
|
148
|
+
<p class="signature first" id="initialize-instance_method">
|
149
|
+
|
150
|
+
- (<tt><a title="LDAP" href="">LDAP</a></tt>) <strong>initialize</strong>(args = {})
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
</p><div class="docstring">
|
155
|
+
<div class="discussion">
|
156
|
+
<p>
|
157
|
+
Creates a new LDAP auth backend with the given arguments
|
158
|
+
</p>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
<div class="tags">
|
164
|
+
<h3>Parameters:</h3>
|
165
|
+
<ul class="param">
|
166
|
+
|
167
|
+
<li>
|
168
|
+
|
169
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
170
|
+
|
171
|
+
|
172
|
+
<span class='name'>args</span>
|
173
|
+
|
174
|
+
|
175
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
176
|
+
|
177
|
+
|
178
|
+
—
|
179
|
+
|
180
|
+
The arguments to construct the backend with
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
</ul>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<h3>Options Hash (<tt>args</tt>):</h3>
|
192
|
+
<ul class="option">
|
193
|
+
|
194
|
+
<li>
|
195
|
+
<span class="type">(<tt>String</tt>)</span>
|
196
|
+
<span class="name">:host</span>
|
197
|
+
<span class="default">
|
198
|
+
|
199
|
+
<span class="na">N/A</span>
|
200
|
+
|
201
|
+
</span>
|
202
|
+
—
|
203
|
+
The LDAP server host to connect to
|
204
|
+
|
205
|
+
|
206
|
+
</tr>
|
207
|
+
|
208
|
+
<li>
|
209
|
+
<span class="type">(<tt>Hash</tt>)</span>
|
210
|
+
<span class="name">:auth</span>
|
211
|
+
<span class="default">
|
212
|
+
|
213
|
+
<span class="na">N/A</span>
|
214
|
+
|
215
|
+
</span>
|
216
|
+
—
|
217
|
+
The auth method ruby-net-ldap should use
|
218
|
+
|
219
|
+
|
220
|
+
</tr>
|
221
|
+
|
222
|
+
<li>
|
223
|
+
<span class="type">(<tt>String</tt>)</span>
|
224
|
+
<span class="name">:base</span>
|
225
|
+
<span class="default">
|
226
|
+
|
227
|
+
<span class="na">N/A</span>
|
228
|
+
|
229
|
+
</span>
|
230
|
+
—
|
231
|
+
The treebase to check against
|
232
|
+
|
233
|
+
|
234
|
+
</tr>
|
235
|
+
|
236
|
+
</ul>
|
237
|
+
|
238
|
+
<h3>Returns:</h3>
|
239
|
+
<ul class="return">
|
240
|
+
|
241
|
+
<li>
|
242
|
+
|
243
|
+
<span class='type'>(<tt><a title="LDAP" href="">LDAP</a></tt>)</span>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
—
|
249
|
+
|
250
|
+
a new instance of <tt>LDAP</tt>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
</li>
|
255
|
+
|
256
|
+
</ul>
|
257
|
+
|
258
|
+
</div><table class="source_code">
|
259
|
+
<tr>
|
260
|
+
<td>
|
261
|
+
<pre class="lines">
|
262
|
+
|
263
|
+
|
264
|
+
11
|
265
|
+
12
|
266
|
+
13
|
267
|
+
14
|
268
|
+
15
|
269
|
+
16</pre>
|
270
|
+
</td>
|
271
|
+
<td>
|
272
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/backends/ldap.rb', line 11</span>
|
273
|
+
|
274
|
+
<span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='args identifier id'>args</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
275
|
+
<span class='@host ivar id'>@host</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:host</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"Host must be given as :host"</span><span class='rparen token'>)</span>
|
276
|
+
<span class='@auth ivar id'>@auth</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:auth</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"Auth must be given as :auth"</span><span class='rparen token'>)</span>
|
277
|
+
<span class='@base ivar id'>@base</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='symbol val'>:base</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"Base must be given as :base"</span><span class='rparen token'>)</span>
|
278
|
+
<span class='@filter ivar id'>@filter</span> <span class='assign token'>=</span> <span class='lambda identifier id'>lambda</span> <span class='lbrace token'>{</span> <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>"Set a filter block on this object using the 'filter' writer"</span><span class='rparen token'>)</span> <span class='rbrace token'>}</span>
|
279
|
+
<span class='end end kw'>end</span>
|
280
|
+
</pre>
|
281
|
+
</td>
|
282
|
+
</tr>
|
283
|
+
</table>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div id="attr_details">
|
289
|
+
<h2>Attribute Details</h2>
|
290
|
+
|
291
|
+
|
292
|
+
<span id="filter=-instance_method"></span>
|
293
|
+
<span id=""></span>
|
294
|
+
<div class="method_details first">
|
295
|
+
<p class="signature first" id="filter=-instance_method">
|
296
|
+
|
297
|
+
- (<tt>Object</tt>) <strong>filter=</strong>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
</p><div class="docstring">
|
302
|
+
<div class="discussion">
|
303
|
+
<p>
|
304
|
+
Sets the attribute <tt>filter</tt>
|
305
|
+
</p>
|
306
|
+
|
307
|
+
|
308
|
+
</div>
|
309
|
+
</div>
|
310
|
+
<div class="tags">
|
311
|
+
<h3>Parameters:</h3>
|
312
|
+
<ul class="param">
|
313
|
+
|
314
|
+
<li>
|
315
|
+
|
316
|
+
<span class='type'></span>
|
317
|
+
|
318
|
+
|
319
|
+
<span class='name'>value</span>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
—
|
324
|
+
|
325
|
+
the value to set the attribute <tt>filter</tt> to.
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
</li>
|
330
|
+
|
331
|
+
</ul>
|
332
|
+
|
333
|
+
</div><table class="source_code">
|
334
|
+
<tr>
|
335
|
+
<td>
|
336
|
+
<pre class="lines">
|
337
|
+
|
338
|
+
|
339
|
+
4
|
340
|
+
5
|
341
|
+
6</pre>
|
342
|
+
</td>
|
343
|
+
<td>
|
344
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/backends/ldap.rb', line 4</span>
|
345
|
+
|
346
|
+
<span class='def def kw'>def</span> <span class='filter= identifier id'>filter=</span><span class='lparen token'>(</span><span class='value identifier id'>value</span><span class='rparen token'>)</span>
|
347
|
+
<span class='@filter ivar id'>@filter</span> <span class='assign token'>=</span> <span class='value identifier id'>value</span>
|
348
|
+
<span class='end end kw'>end</span>
|
349
|
+
</pre>
|
350
|
+
</td>
|
351
|
+
</tr>
|
352
|
+
</table>
|
353
|
+
</div>
|
354
|
+
|
355
|
+
</div>
|
356
|
+
|
357
|
+
|
358
|
+
<div id="method_details">
|
359
|
+
<h2>Method Details</h2>
|
360
|
+
|
361
|
+
<div class="method_details first">
|
362
|
+
<p class="signature first" id="authenticate-instance_method">
|
363
|
+
|
364
|
+
- (<tt>true</tt>) <strong>authenticate</strong>(identifier, password)
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
</p><div class="docstring">
|
369
|
+
<div class="discussion">
|
370
|
+
<p>
|
371
|
+
Authenticates the given credentials against LDAP
|
372
|
+
</p>
|
373
|
+
|
374
|
+
|
375
|
+
</div>
|
376
|
+
</div>
|
377
|
+
<div class="tags">
|
378
|
+
<h3>Parameters:</h3>
|
379
|
+
<ul class="param">
|
380
|
+
|
381
|
+
<li>
|
382
|
+
|
383
|
+
<span class='type'>(<tt>String</tt>)</span>
|
384
|
+
|
385
|
+
|
386
|
+
<span class='name'>identifier</span>
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
—
|
391
|
+
|
392
|
+
The identifier to filter on
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
</li>
|
397
|
+
|
398
|
+
<li>
|
399
|
+
|
400
|
+
<span class='type'>(<tt>String</tt>)</span>
|
401
|
+
|
402
|
+
|
403
|
+
<span class='name'>password</span>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
—
|
408
|
+
|
409
|
+
The password to use
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</li>
|
414
|
+
|
415
|
+
</ul>
|
416
|
+
<h3>Returns:</h3>
|
417
|
+
<ul class="return">
|
418
|
+
|
419
|
+
<li>
|
420
|
+
|
421
|
+
<span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
—
|
427
|
+
|
428
|
+
A boolean indicating authentication success
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
</li>
|
433
|
+
|
434
|
+
</ul>
|
435
|
+
|
436
|
+
</div><table class="source_code">
|
437
|
+
<tr>
|
438
|
+
<td>
|
439
|
+
<pre class="lines">
|
440
|
+
|
441
|
+
|
442
|
+
22
|
443
|
+
23
|
444
|
+
24
|
445
|
+
25</pre>
|
446
|
+
</td>
|
447
|
+
<td>
|
448
|
+
<pre class="code"><span class="info file"># File 'lib/kennedy/backends/ldap.rb', line 22</span>
|
449
|
+
|
450
|
+
<span class='def def kw'>def</span> <span class='authenticate identifier id'>authenticate</span><span class='lparen token'>(</span><span class='identifier identifier id'>identifier</span><span class='comma token'>,</span> <span class='password identifier id'>password</span><span class='rparen token'>)</span>
|
451
|
+
<span class='filter_string identifier id'>filter_string</span> <span class='assign token'>=</span> <span class='@filter ivar id'>@filter</span><span class='dot token'>.</span><span class='call identifier id'>call</span><span class='lparen token'>(</span><span class='identifier identifier id'>identifier</span><span class='rparen token'>)</span>
|
452
|
+
<span class='notop op'>!</span><span class='notop op'>!</span><span class='ldap_conn identifier id'>ldap_conn</span><span class='dot token'>.</span><span class='bind_as identifier id'>bind_as</span><span class='lparen token'>(</span><span class='symbol val'>:filter</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='filter_string identifier id'>filter_string</span><span class='comma token'>,</span> <span class='symbol val'>:password</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='password identifier id'>password</span><span class='rparen token'>)</span>
|
453
|
+
<span class='end end kw'>end</span>
|
454
|
+
</pre>
|
455
|
+
</td>
|
456
|
+
</tr>
|
457
|
+
</table>
|
458
|
+
</div>
|
459
|
+
|
460
|
+
</div>
|
461
|
+
|
462
|
+
</div>
|
463
|
+
|
464
|
+
<div id="footer">
|
465
|
+
Generated on Tue Dec 8 16:39:39 2009 by
|
466
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
467
|
+
0.4.0 (ruby-1.8.7).
|
468
|
+
</div>
|
469
|
+
|
470
|
+
</body>
|
471
|
+
</html>
|