rubius 0.0.2 → 0.0.3
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/VERSION +1 -1
- data/lib/rubius.rb +1 -0
- data/lib/rubius/authenticator.rb +10 -5
- data/lib/rubius/dictionary.rb +32 -2
- data/lib/rubius/exceptions.rb +6 -0
- data/lib/rubius/rails.rb +3 -3
- data/rubius.gemspec +25 -2
- data/test/helper.rb +42 -0
- data/test/test_authenticator.rb +84 -0
- data/test/test_dictionary.rb +58 -12
- data/test/test_rails.rb +62 -0
- metadata +74 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/rubius.rb
CHANGED
data/lib/rubius/authenticator.rb
CHANGED
@@ -19,15 +19,17 @@ module Rubius
|
|
19
19
|
|
20
20
|
@sock = nil
|
21
21
|
|
22
|
-
@
|
23
|
-
|
24
|
-
@identifier = Process.pid && 0xff
|
22
|
+
@identifier = Process.pid & 0xff
|
25
23
|
end
|
26
24
|
|
27
|
-
def init_from_config(config_file)
|
28
|
-
env
|
25
|
+
def init_from_config(config_file, env=nil)
|
26
|
+
if env.nil?
|
27
|
+
env = defined?(::Rails) ? ::Rails.env : 'development'
|
28
|
+
end
|
29
29
|
|
30
30
|
config = YAML.load_file(config_file)
|
31
|
+
raise Rubius::MissingEnvironmentConfiguration unless config.has_key?(env)
|
32
|
+
|
31
33
|
@host = config[env]["host"]
|
32
34
|
@port = config[env]["port"] if config[env]["port"]
|
33
35
|
@secret = config[env]["secret"]
|
@@ -38,8 +40,11 @@ module Rubius
|
|
38
40
|
end
|
39
41
|
|
40
42
|
@nas_ip = config[env]["nas_ip"] if config[env]["nas_ip"]
|
43
|
+
@nas_ip ||= UDPSocket.open {|s| s.connect(@host, 1); s.addr.last }
|
41
44
|
|
42
45
|
setup_connection
|
46
|
+
rescue Errno::ENOENT
|
47
|
+
raise Rubius::MissingConfiguration
|
43
48
|
end
|
44
49
|
|
45
50
|
def authenticate(username, password)
|
data/lib/rubius/dictionary.rb
CHANGED
@@ -14,6 +14,8 @@ module Rubius
|
|
14
14
|
dict_lines = IO.readlines(dictionary_file)
|
15
15
|
|
16
16
|
vendor_id = DEFAULT_VENDOR
|
17
|
+
skip_until_next_vendor = false
|
18
|
+
|
17
19
|
dict_lines.each do |line|
|
18
20
|
next if line =~ /^\#/
|
19
21
|
next if (tokens = line.split(/\s+/)).empty?
|
@@ -21,15 +23,41 @@ module Rubius
|
|
21
23
|
entry_type = tokens[0].upcase
|
22
24
|
case entry_type
|
23
25
|
when VENDOR
|
24
|
-
|
26
|
+
skip_until_next_vendor = false
|
27
|
+
|
28
|
+
# If the vendor_id string is nil or empty, we should skip this entire block
|
29
|
+
# until we find another VENDOR definition, also ignore all VALUEs and ATTRIBUTEs
|
30
|
+
# until the next VENDOR because otherwise, they will be included in the wrong VENDOR
|
31
|
+
vendor_id_str = tokens[2]
|
32
|
+
if vendor_id_str.nil? || vendor_id_str.empty?
|
33
|
+
skip_until_next_vendor = true
|
34
|
+
next
|
35
|
+
end
|
36
|
+
|
37
|
+
# VENDOR id should be higher than 0, skip everything if it isn't
|
38
|
+
vendor_id = vendor_id_str.to_i
|
39
|
+
if vendor_id <= 0
|
40
|
+
skip_until_next_vendor = true
|
41
|
+
next
|
42
|
+
end
|
43
|
+
|
25
44
|
vendor_name = tokens[1].strip
|
26
45
|
@dictionary[vendor_id] ||= {:name => vendor_name}
|
27
46
|
when ATTRIBUTE
|
47
|
+
next if skip_until_next_vendor
|
48
|
+
next if tokens[1].nil? || tokens[2].to_i <= 0 || tokens[3].nil?
|
28
49
|
@dictionary[vendor_id][tokens[2].to_i] = {:name => tokens[1].strip, :type => tokens[3].strip}
|
29
50
|
when VALUE
|
51
|
+
next if skip_until_next_vendor
|
30
52
|
@dictionary[vendor_id][tokens[1]] = {tokens[2].strip => tokens[3].to_i}
|
31
53
|
end
|
32
54
|
end
|
55
|
+
rescue Errno::ENOENT
|
56
|
+
raise Rubius::InvalidDictionaryError
|
57
|
+
end
|
58
|
+
|
59
|
+
def vendors
|
60
|
+
@dictionary.collect{|k,v| v[:name]}.reject{|n| n.empty?}
|
33
61
|
end
|
34
62
|
|
35
63
|
def vendor_name(vendor_id = DEFAULT_VENDOR)
|
@@ -45,7 +73,9 @@ module Rubius
|
|
45
73
|
end
|
46
74
|
|
47
75
|
def attribute_id(attr_name, vendor_id = DEFAULT_VENDOR)
|
48
|
-
@dictionary[vendor_id].reject{|k,v| !v.is_a?(Hash) || v[:name]!=attr_name}
|
76
|
+
vendor_object = @dictionary[vendor_id].reject{|k,v| !v.is_a?(Hash) || v[:name]!=attr_name}
|
77
|
+
vendor_object = vendor_object.to_a if RUBY_VERSION < "1.9.2"
|
78
|
+
vendor_object.flatten.first
|
49
79
|
end
|
50
80
|
|
51
81
|
private
|
data/lib/rubius/rails.rb
CHANGED
@@ -3,16 +3,16 @@ module Rubius
|
|
3
3
|
def self.init(root = nil, env = nil)
|
4
4
|
base_dir = root
|
5
5
|
if root.nil?
|
6
|
-
root = defined?(Rails) ? ::Rails.root : FileUtils.pwd
|
6
|
+
root = defined?(::Rails) ? ::Rails.root : FileUtils.pwd
|
7
7
|
base_dir = File.expand_path(File.join(root, 'config'))
|
8
8
|
end
|
9
9
|
|
10
10
|
if env.nil?
|
11
|
-
env = defined?(Rails) ? ::Rails.env : 'development'
|
11
|
+
env = defined?(::Rails) ? ::Rails.env : 'development'
|
12
12
|
end
|
13
13
|
|
14
14
|
config_file = File.join(base_dir, 'rubius.yml')
|
15
|
-
Rubius::Authenticator.instance.init_from_config(config_file)
|
15
|
+
Rubius::Authenticator.instance.init_from_config(config_file, env)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/rubius.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rubius}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ralph Rooding"]
|
12
|
-
s.date = %q{2011-04-
|
12
|
+
s.date = %q{2011-04-28}
|
13
13
|
s.description = %q{Rubius provides a simple interface to RADIUS authentication}
|
14
14
|
s.email = %q{ralph@izerion.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -30,12 +30,15 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/rubius.rb",
|
31
31
|
"lib/rubius/authenticator.rb",
|
32
32
|
"lib/rubius/dictionary.rb",
|
33
|
+
"lib/rubius/exceptions.rb",
|
33
34
|
"lib/rubius/packet.rb",
|
34
35
|
"lib/rubius/rails.rb",
|
35
36
|
"lib/rubius/string.rb",
|
36
37
|
"rubius.gemspec",
|
37
38
|
"test/helper.rb",
|
39
|
+
"test/test_authenticator.rb",
|
38
40
|
"test/test_dictionary.rb",
|
41
|
+
"test/test_rails.rb",
|
39
42
|
"test/test_string.rb"
|
40
43
|
]
|
41
44
|
s.homepage = %q{http://github.com/rahvin/rubius}
|
@@ -45,7 +48,9 @@ Gem::Specification.new do |s|
|
|
45
48
|
s.summary = %q{A simple ruby RADIUS authentication gem}
|
46
49
|
s.test_files = [
|
47
50
|
"test/helper.rb",
|
51
|
+
"test/test_authenticator.rb",
|
48
52
|
"test/test_dictionary.rb",
|
53
|
+
"test/test_rails.rb",
|
49
54
|
"test/test_string.rb"
|
50
55
|
]
|
51
56
|
|
@@ -75,6 +80,12 @@ Gem::Specification.new do |s|
|
|
75
80
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
76
81
|
s.add_development_dependency(%q<simplecov>, [">= 0.4.0"])
|
77
82
|
s.add_development_dependency(%q<autotest-standalone>, ["~> 4.5.5"])
|
83
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
84
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
85
|
+
s.add_development_dependency(%q<mocha>, ["~> 0.9.12"])
|
86
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
87
|
+
s.add_development_dependency(%q<simplecov>, [">= 0.4.0"])
|
88
|
+
s.add_development_dependency(%q<autotest-standalone>, ["~> 4.5.5"])
|
78
89
|
else
|
79
90
|
s.add_dependency(%q<rubius>, [">= 0"])
|
80
91
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
@@ -98,6 +109,12 @@ Gem::Specification.new do |s|
|
|
98
109
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
99
110
|
s.add_dependency(%q<simplecov>, [">= 0.4.0"])
|
100
111
|
s.add_dependency(%q<autotest-standalone>, ["~> 4.5.5"])
|
112
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
113
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
114
|
+
s.add_dependency(%q<mocha>, ["~> 0.9.12"])
|
115
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
116
|
+
s.add_dependency(%q<simplecov>, [">= 0.4.0"])
|
117
|
+
s.add_dependency(%q<autotest-standalone>, ["~> 4.5.5"])
|
101
118
|
end
|
102
119
|
else
|
103
120
|
s.add_dependency(%q<rubius>, [">= 0"])
|
@@ -122,6 +139,12 @@ Gem::Specification.new do |s|
|
|
122
139
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
123
140
|
s.add_dependency(%q<simplecov>, [">= 0.4.0"])
|
124
141
|
s.add_dependency(%q<autotest-standalone>, ["~> 4.5.5"])
|
142
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
143
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
144
|
+
s.add_dependency(%q<mocha>, ["~> 0.9.12"])
|
145
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
146
|
+
s.add_dependency(%q<simplecov>, [">= 0.4.0"])
|
147
|
+
s.add_dependency(%q<autotest-standalone>, ["~> 4.5.5"])
|
125
148
|
end
|
126
149
|
end
|
127
150
|
|
data/test/helper.rb
CHANGED
@@ -54,3 +54,45 @@ RADIUS_DICTIONARY = [
|
|
54
54
|
"",
|
55
55
|
"ATTRIBUTE Juniper-Local-User-Name 1 string"
|
56
56
|
]
|
57
|
+
|
58
|
+
DICT_BROKEN_VENDOR = [
|
59
|
+
"# broken vendor line follows (missing id):",
|
60
|
+
"VENDOR Microsoft",
|
61
|
+
"",
|
62
|
+
"ATTRIBUTE Not-Included 8344 string",
|
63
|
+
"",
|
64
|
+
"# non-broken vendor:",
|
65
|
+
"VENDOR Apple 25",
|
66
|
+
"ATTRIBUTE Is-Cool 1337 integer",
|
67
|
+
"",
|
68
|
+
"VENDOR NoId id"
|
69
|
+
]
|
70
|
+
|
71
|
+
DICT_BROKEN_ATTR = [
|
72
|
+
"# broken attribute line:",
|
73
|
+
"VENDOR IBM 123",
|
74
|
+
"",
|
75
|
+
"ATTRIBUTE IBM-Attr-Included 5137 string",
|
76
|
+
"ATTRIBUTE IBM-Attr-NotIncluded 5138",
|
77
|
+
"ATTRIBUTE IBM-Attr-NotIncluded2 asdf integer",
|
78
|
+
"ATTRIBUTE IBM-Attr-Included2 5139 string",
|
79
|
+
""
|
80
|
+
]
|
81
|
+
|
82
|
+
CONFIG_FILE = {
|
83
|
+
'development' => {
|
84
|
+
'host' => '127.0.0.1',
|
85
|
+
'port' => 1812,
|
86
|
+
'timeout' => 10,
|
87
|
+
'secret' => 'development-secret',
|
88
|
+
'dictionary' => 'radius-dictionary'
|
89
|
+
},
|
90
|
+
'production' => {
|
91
|
+
'host' => '10.1.0.254',
|
92
|
+
'port' => 1812,
|
93
|
+
'timeout' => 10,
|
94
|
+
'secret' => 'production-secret',
|
95
|
+
'dictionary' => 'radius-dictionary',
|
96
|
+
'nas_ip' => '10.1.0.1'
|
97
|
+
}
|
98
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestAuthenticator < Test::Unit::TestCase
|
4
|
+
context "A Rubius::Authenticator instance" do
|
5
|
+
setup do
|
6
|
+
Process.stubs(:pid).returns(93354)
|
7
|
+
|
8
|
+
UDPSocket.any_instance
|
9
|
+
UDPSocket.any_instance.stubs(:addr).returns(["AF_INET", 65194, "10.1.0.45", "10.1.0.45"])
|
10
|
+
|
11
|
+
@authenticator = Rubius::Authenticator.instance
|
12
|
+
end
|
13
|
+
|
14
|
+
should "generate an identifier" do
|
15
|
+
assert_equal 170, @authenticator.instance_eval { @identifier }
|
16
|
+
end
|
17
|
+
|
18
|
+
should "increment the identifier" do
|
19
|
+
identifier = @authenticator.instance_eval { @identifier }
|
20
|
+
identifier += 1
|
21
|
+
|
22
|
+
assert @authenticator.instance_eval { increment_identifier! }
|
23
|
+
|
24
|
+
assert_equal identifier, @authenticator.instance_eval { @identifier }
|
25
|
+
end
|
26
|
+
|
27
|
+
should "overflow the identifier beyond 255" do
|
28
|
+
@authenticator.instance_eval { @identifier = 254 }
|
29
|
+
assert_equal 254, @authenticator.instance_eval { @identifier }
|
30
|
+
|
31
|
+
assert @authenticator.instance_eval { increment_identifier! }
|
32
|
+
assert_equal 255, @authenticator.instance_eval { @identifier }
|
33
|
+
|
34
|
+
assert @authenticator.instance_eval { increment_identifier! }
|
35
|
+
assert_equal 0, @authenticator.instance_eval { @identifier }
|
36
|
+
|
37
|
+
assert @authenticator.instance_eval { increment_identifier! }
|
38
|
+
assert_equal 1, @authenticator.instance_eval { @identifier }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "supplied with a configuration file" do
|
42
|
+
should "read and parse the configuration file" do
|
43
|
+
YAML.stubs(:load_file).returns(CONFIG_FILE)
|
44
|
+
|
45
|
+
@authenticator.init_from_config("rubius.yml", 'development')
|
46
|
+
assert_equal 'development-secret', @authenticator.instance_eval { @secret }
|
47
|
+
end
|
48
|
+
|
49
|
+
should "use Rails.env if env is not passed and running in a Rails application" do
|
50
|
+
YAML.stubs(:load_file).returns(CONFIG_FILE)
|
51
|
+
::Rails.stubs(:env).returns('production')
|
52
|
+
|
53
|
+
@authenticator.init_from_config("rubius.yml")
|
54
|
+
assert_equal 'production-secret', @authenticator.instance_eval { @secret }
|
55
|
+
end
|
56
|
+
|
57
|
+
should "handle a non-existent config file" do
|
58
|
+
YAML.stubs(:load_file).raises(Errno::ENOENT)
|
59
|
+
::Rails.stubs(:env).returns('production')
|
60
|
+
|
61
|
+
assert_raises Rubius::MissingConfiguration do
|
62
|
+
@authenticator.init_from_config("/does/not/exist/rubius.yml")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
should "handle an empty config section" do
|
67
|
+
YAML.stubs(:load_file).returns(CONFIG_FILE)
|
68
|
+
::Rails.stubs(:env).returns('staging')
|
69
|
+
|
70
|
+
assert_raises Rubius::MissingEnvironmentConfiguration do
|
71
|
+
@authenticator.init_from_config("rubius.yml")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
should "setup a connection to the specified server" do
|
76
|
+
YAML.stubs(:load_file).returns(CONFIG_FILE)
|
77
|
+
::Rails.stubs(:env).returns('production')
|
78
|
+
UDPSocket.any_instance.stubs(:connect).with('10.1.0.254', 1812).returns(true)
|
79
|
+
|
80
|
+
assert @authenticator.init_from_config("rubius.yml")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/test/test_dictionary.rb
CHANGED
@@ -1,22 +1,68 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestDictionary < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
@dictionary = Rubius::Dictionary.new
|
6
|
-
end
|
7
|
-
|
8
4
|
context "A Rubius::Dictionary" do
|
9
|
-
|
10
|
-
|
5
|
+
setup do
|
6
|
+
@dictionary = Rubius::Dictionary.new
|
7
|
+
end
|
11
8
|
|
12
|
-
|
9
|
+
context "provided with a valid RADIUS dictionary file" do
|
10
|
+
setup do
|
11
|
+
IO.stubs(:readlines).returns(RADIUS_DICTIONARY)
|
12
|
+
end
|
13
|
+
|
14
|
+
should "load and parse it" do
|
15
|
+
assert @dictionary.load("filename")
|
16
|
+
|
17
|
+
assert_equal "Cisco", @dictionary.vendor_name(9)
|
18
|
+
assert_equal "Juniper", @dictionary.vendor_name(2636)
|
19
|
+
|
20
|
+
assert_equal "Service-Type", @dictionary.attribute_name(6)
|
21
|
+
assert_equal "string", @dictionary.attribute_type(2, 9)
|
22
|
+
assert_equal 1, @dictionary.attribute_id("Juniper-Local-User-Name", 2636)
|
23
|
+
end
|
24
|
+
end
|
13
25
|
|
14
|
-
|
15
|
-
|
26
|
+
context "provided with a non-existant RADIUS dictionary file" do
|
27
|
+
setup do
|
28
|
+
IO.stubs(:readlines).raises(Errno::ENOENT)
|
29
|
+
end
|
30
|
+
|
31
|
+
should "raise an exception" do
|
32
|
+
assert_raise Rubius::InvalidDictionaryError do
|
33
|
+
@dictionary.load("/no/existing/file")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "provided with a malformed RADIUS dictionary file" do
|
39
|
+
should "handle broken VENDOR lines" do
|
40
|
+
IO.stubs(:readlines).returns(RADIUS_DICTIONARY+DICT_BROKEN_VENDOR)
|
41
|
+
|
42
|
+
assert @dictionary.load("filename")
|
43
|
+
|
44
|
+
assert !@dictionary.vendors.include?("Microsoft")
|
45
|
+
assert_nil @dictionary.attribute_name(8344)
|
46
|
+
|
47
|
+
assert @dictionary.vendors.include?("Apple")
|
48
|
+
assert_equal "Is-Cool", @dictionary.attribute_name(1337, 25)
|
49
|
+
|
50
|
+
assert !@dictionary.vendors.include?("NoId")
|
51
|
+
end
|
52
|
+
|
53
|
+
should "handle broken ATTRIBUTE lines" do
|
54
|
+
IO.stubs(:readlines).returns(RADIUS_DICTIONARY+DICT_BROKEN_ATTR)
|
55
|
+
|
56
|
+
assert @dictionary.load("filename")
|
57
|
+
|
58
|
+
assert_equal 'IBM-Attr-Included', @dictionary.attribute_name(5137, 123)
|
59
|
+
assert_nil @dictionary.attribute_name(5138, 123)
|
60
|
+
assert_equal 'IBM-Attr-Included2', @dictionary.attribute_name(5139, 123)
|
61
|
+
end
|
16
62
|
|
17
|
-
|
18
|
-
|
19
|
-
|
63
|
+
should "handle broken VALUE lines" do
|
64
|
+
|
65
|
+
end
|
20
66
|
end
|
21
67
|
end
|
22
68
|
end
|
data/test/test_rails.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
module Rails; end
|
4
|
+
|
5
|
+
class TestRails < Test::Unit::TestCase
|
6
|
+
context "a Rubius::Rails.init call" do
|
7
|
+
context "in a standalone application" do
|
8
|
+
setup do
|
9
|
+
Object.instance_eval{ remove_const("Rails") } if defined?(::Rails)
|
10
|
+
end
|
11
|
+
|
12
|
+
context "without any parameters" do
|
13
|
+
should "try to load the config file at current_dir/config/rubius.yml with the 'development' environment" do
|
14
|
+
Rubius::Authenticator.any_instance.stubs(:init_from_config).with(File.join(FileUtils.pwd, 'config', 'rubius.yml'), 'development').returns(true)
|
15
|
+
assert Rubius::Rails.init
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "with path specified" do
|
20
|
+
should "try to load the config at the specified path with the 'development' environment" do
|
21
|
+
config_file = File.join('path', 'to', 'config')
|
22
|
+
|
23
|
+
Rubius::Authenticator.any_instance.stubs(:init_from_config).with(File.join(config_file, 'rubius.yml'), 'development').returns(true)
|
24
|
+
|
25
|
+
assert Rubius::Rails.init(config_file)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "in a Rails application" do
|
31
|
+
setup do
|
32
|
+
::Rails.stubs(:env).returns('stubbed')
|
33
|
+
::Rails.stubs(:root).returns('/home/rails')
|
34
|
+
end
|
35
|
+
|
36
|
+
should "use Rails path and environment" do
|
37
|
+
Rubius::Authenticator.any_instance.stubs(:init_from_config).with(File.join('/', 'home', 'rails', 'config', 'rubius.yml'), 'stubbed').returns(true)
|
38
|
+
assert Rubius::Rails.init
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "with a non-existant configuration file" do
|
43
|
+
should "raise an exception" do
|
44
|
+
Rubius::Authenticator.any_instance.stubs(:init_from_config).raises(Rubius::MissingConfiguration)
|
45
|
+
|
46
|
+
assert_raises Rubius::MissingConfiguration do
|
47
|
+
Rubius::Rails.init('/bla')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "with a configuration file thats missing the current environment" do
|
53
|
+
should "raise an exception" do
|
54
|
+
Rubius::Authenticator.any_instance.stubs(:init_from_config).raises(Rubius::MissingEnvironmentConfiguration)
|
55
|
+
|
56
|
+
assert_raises Rubius::MissingEnvironmentConfiguration do
|
57
|
+
Rubius::Rails.init('/bla')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rubius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ralph Rooding
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-28 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -255,6 +255,72 @@ dependencies:
|
|
255
255
|
type: :development
|
256
256
|
prerelease: false
|
257
257
|
version_requirements: *id022
|
258
|
+
- !ruby/object:Gem::Dependency
|
259
|
+
name: bundler
|
260
|
+
requirement: &id023 !ruby/object:Gem::Requirement
|
261
|
+
none: false
|
262
|
+
requirements:
|
263
|
+
- - ~>
|
264
|
+
- !ruby/object:Gem::Version
|
265
|
+
version: 1.0.0
|
266
|
+
type: :development
|
267
|
+
prerelease: false
|
268
|
+
version_requirements: *id023
|
269
|
+
- !ruby/object:Gem::Dependency
|
270
|
+
name: shoulda
|
271
|
+
requirement: &id024 !ruby/object:Gem::Requirement
|
272
|
+
none: false
|
273
|
+
requirements:
|
274
|
+
- - ">="
|
275
|
+
- !ruby/object:Gem::Version
|
276
|
+
version: "0"
|
277
|
+
type: :development
|
278
|
+
prerelease: false
|
279
|
+
version_requirements: *id024
|
280
|
+
- !ruby/object:Gem::Dependency
|
281
|
+
name: mocha
|
282
|
+
requirement: &id025 !ruby/object:Gem::Requirement
|
283
|
+
none: false
|
284
|
+
requirements:
|
285
|
+
- - ~>
|
286
|
+
- !ruby/object:Gem::Version
|
287
|
+
version: 0.9.12
|
288
|
+
type: :development
|
289
|
+
prerelease: false
|
290
|
+
version_requirements: *id025
|
291
|
+
- !ruby/object:Gem::Dependency
|
292
|
+
name: jeweler
|
293
|
+
requirement: &id026 !ruby/object:Gem::Requirement
|
294
|
+
none: false
|
295
|
+
requirements:
|
296
|
+
- - ~>
|
297
|
+
- !ruby/object:Gem::Version
|
298
|
+
version: 1.5.2
|
299
|
+
type: :development
|
300
|
+
prerelease: false
|
301
|
+
version_requirements: *id026
|
302
|
+
- !ruby/object:Gem::Dependency
|
303
|
+
name: simplecov
|
304
|
+
requirement: &id027 !ruby/object:Gem::Requirement
|
305
|
+
none: false
|
306
|
+
requirements:
|
307
|
+
- - ">="
|
308
|
+
- !ruby/object:Gem::Version
|
309
|
+
version: 0.4.0
|
310
|
+
type: :development
|
311
|
+
prerelease: false
|
312
|
+
version_requirements: *id027
|
313
|
+
- !ruby/object:Gem::Dependency
|
314
|
+
name: autotest-standalone
|
315
|
+
requirement: &id028 !ruby/object:Gem::Requirement
|
316
|
+
none: false
|
317
|
+
requirements:
|
318
|
+
- - ~>
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: 4.5.5
|
321
|
+
type: :development
|
322
|
+
prerelease: false
|
323
|
+
version_requirements: *id028
|
258
324
|
description: Rubius provides a simple interface to RADIUS authentication
|
259
325
|
email: ralph@izerion.com
|
260
326
|
executables: []
|
@@ -278,12 +344,15 @@ files:
|
|
278
344
|
- lib/rubius.rb
|
279
345
|
- lib/rubius/authenticator.rb
|
280
346
|
- lib/rubius/dictionary.rb
|
347
|
+
- lib/rubius/exceptions.rb
|
281
348
|
- lib/rubius/packet.rb
|
282
349
|
- lib/rubius/rails.rb
|
283
350
|
- lib/rubius/string.rb
|
284
351
|
- rubius.gemspec
|
285
352
|
- test/helper.rb
|
353
|
+
- test/test_authenticator.rb
|
286
354
|
- test/test_dictionary.rb
|
355
|
+
- test/test_rails.rb
|
287
356
|
- test/test_string.rb
|
288
357
|
has_rdoc: true
|
289
358
|
homepage: http://github.com/rahvin/rubius
|
@@ -299,7 +368,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
299
368
|
requirements:
|
300
369
|
- - ">="
|
301
370
|
- !ruby/object:Gem::Version
|
302
|
-
hash: -
|
371
|
+
hash: -3168222850208807811
|
303
372
|
segments:
|
304
373
|
- 0
|
305
374
|
version: "0"
|
@@ -318,5 +387,7 @@ specification_version: 3
|
|
318
387
|
summary: A simple ruby RADIUS authentication gem
|
319
388
|
test_files:
|
320
389
|
- test/helper.rb
|
390
|
+
- test/test_authenticator.rb
|
321
391
|
- test/test_dictionary.rb
|
392
|
+
- test/test_rails.rb
|
322
393
|
- test/test_string.rb
|