authlogic_radius 0.0.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f47fdb68b7cb683c82feb96fb92cebf5d7164bc1
4
+ data.tar.gz: f1474a9c5848f13a2e13ed1235f55d31d4777a13
5
+ SHA512:
6
+ metadata.gz: f62eea58c4ea1f177d81f578d9578b099c17426b68831e6005254a748d916e7ae0790a9024ac20a11d7f9cf88d205024b1b248608ed62072a0d85e5bd15c1e4d
7
+ data.tar.gz: d0deac3ba819e6a5329ad4a4bbb8526af1f05a6dae681e866b959b1742c73056ca9c5da8faf3e99112722db8b6b26efe28e19a924dbca8da384f7fc651ceae38
@@ -3,9 +3,11 @@
3
3
 
4
4
  This is a simple gem to allow authentication against a radius server
5
5
 
6
- Mostly it is a duplication or authlogic_ldap, with a global replace of "ldap" with "radius"...
6
+ Mostly it is a duplication of authlogic_ldap, with a global replace of "ldap" with "radius"...
7
7
  with a few RADIUS specific bits.
8
8
 
9
+ This version is tested only with ruby 2.0 and Rail 3 and 4
10
+
9
11
 
10
12
  == Links
11
13
  * <b>radiustar</b> http://github.com/pjdavis/radiustar
@@ -13,7 +15,7 @@ with a few RADIUS specific bits.
13
15
  * <b>authlogic_ldap</b> http://github.com/binarylogic/authlogic_ldap
14
16
 
15
17
  == Installation
16
- === 1. Add fields to your database
18
+ === 1. Add fields to your database
17
19
 
18
20
  class AddRadiusFields < ActiveRecord::Migration
19
21
  def self.up
@@ -56,4 +58,4 @@ with a few RADIUS specific bits.
56
58
  self.auto_register_method = :method_in_user_model_that_configures_new_radius_user
57
59
  ...
58
60
  end
59
-
61
+
@@ -162,7 +162,11 @@ module AuthlogicRadius
162
162
  begin
163
163
  req = Radiustar::Request.new("#{radius_host}:#{radius_port}")
164
164
  rescue => e
165
- errors.add_to_base(I18n.t('error_messsages.cannot_resolve_radius_server', :default => "Unable to find a network path to RADIUS server at #{radius_host}:#{radius_port}"))
165
+ if Rails.version.to_i >= 3
166
+ errors.add(:base, I18n.t('error_messsages.cannot_resolve_radius_server', :default => "Unable to find a network path to RADIUS server at #{radius_host}:#{radius_port}"))
167
+ else
168
+ errors.add_to_base(I18n.t('error_messsages.cannot_resolve_radius_server', :default => "Unable to find a network path to RADIUS server at #{radius_host}:#{radius_port}"))
169
+ end
166
170
  return
167
171
  end
168
172
 
@@ -173,10 +177,14 @@ module AuthlogicRadius
173
177
  radius_response = req.authenticate(radius_login,radius_password,radius_shared_secret)
174
178
  end
175
179
  rescue Timeout::Error
176
- errors.add_to_base(I18n.t('error_messages.radius_server_unavailable', :default => "No response from RADIUS server at #{radius_host}:#{radius_port}"))
180
+ if Rails.version.to_i >= 3
181
+ errors.add(:base, I18n.t('error_messages.radius_server_unavailable', :default => "No response from RADIUS server at #{radius_host}:#{radius_port}"))
182
+ else
183
+ errors.add_to_base(I18n.t('error_messages.radius_server_unavailable', :default => "No response from RADIUS server at #{radius_host}:#{radius_port}"))
184
+ end
177
185
  end
178
186
 
179
- if radius_response
187
+ if radius_response && radius_response[:code] == 'Access-Accept'
180
188
  #authentication succeeded, find or create the user
181
189
  self.attempted_record = search_for_record(find_by_radius_login_method, radius_login)
182
190
 
@@ -191,16 +199,28 @@ module AuthlogicRadius
191
199
  Rails.logger.info 'New user created'
192
200
  else
193
201
  Rails.logger.debug "#{self.attempted_record.errors.full_messages}"
194
- errors.add_to_base(I18n.t('error_messages.failed_to_create_local_user', :default => "Failed to create a local user record."))
202
+ if Rails.version.to_i >= 3
203
+ errors.add(:base, I18n.t('error_messages.failed_to_create_local_user', :default => "Failed to create a local user record."))
204
+ else
205
+ errors.add_to_base(I18n.t('error_messages.failed_to_create_local_user', :default => "Failed to create a local user record."))
206
+ end
195
207
  end
196
208
  else
197
209
  errors.add(:radius_login, I18n.t('error_messages.radius_login_not_found', :default => "does not exist")) if attempted_record.blank?
198
210
  end
199
211
  else
200
- errors.add_to_base(I18n.t('error_messages.authentication_failed', :default => "Authentication failed"))
212
+ if Rails.version.to_i >= 3
213
+ errors.add(:base, I18n.t('error_messages.authentication_failed', :default => "Authentication failed"))
214
+ else
215
+ errors.add_to_base(I18n.t('error_messages.authentication_failed', :default => "Authentication failed"))
216
+ end
201
217
  end
202
218
  rescue => e
203
- errors.add_to_base(e.to_s)
219
+ if Rails.version.to_i >= 3
220
+ errors.add(:base, e.to_s)
221
+ else
222
+ errors.add_to_base(e.to_s)
223
+ end
204
224
  Rails.logger.error(e.to_s)
205
225
  Rails.logger.error(e.backtrace)
206
226
  end
metadata CHANGED
@@ -1,103 +1,79 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: authlogic_radius
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 6
10
- version: 0.0.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Brad Langhorst
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-04-24 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2014-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: authlogic
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 2
31
- - 0
32
- version: "2.0"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
33
20
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: radiustar
37
21
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: radiustar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
41
31
  - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 25
44
- segments:
45
- - 0
46
- - 0
47
- - 3
32
+ - !ruby/object:Gem::Version
48
33
  version: 0.0.3
49
34
  type: :runtime
50
- version_requirements: *id002
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.3
51
41
  description: |
52
42
  This is a simple gem to allow authentication against a RADIUS server.
53
-
54
43
  email: langhorst@neb.com
55
44
  executables: []
56
-
57
45
  extensions: []
58
-
59
- extra_rdoc_files:
46
+ extra_rdoc_files:
47
+ - LICENSE
48
+ - README.rdoc
49
+ files:
60
50
  - LICENSE
61
51
  - README.rdoc
62
- files:
63
52
  - lib/authlogic_radius.rb
64
53
  - lib/authlogic_radius/acts_as_authentic.rb
65
54
  - lib/authlogic_radius/session.rb
66
55
  - lib/authlogic_radius/version.rb
67
- - LICENSE
68
- - README.rdoc
69
56
  homepage: http://github.com/bwlang/authlogic_radius
70
57
  licenses: []
71
-
58
+ metadata: {}
72
59
  post_install_message:
73
60
  rdoc_options: []
74
-
75
- require_paths:
61
+ require_paths:
76
62
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
- requirements:
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
80
65
  - - ">="
81
- - !ruby/object:Gem::Version
82
- hash: 3
83
- segments:
84
- - 0
85
- version: "0"
86
- required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
89
70
  - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
95
73
  requirements: []
96
-
97
74
  rubyforge_project:
98
- rubygems_version: 1.8.23
75
+ rubygems_version: 2.2.0
99
76
  signing_key:
100
- specification_version: 3
77
+ specification_version: 4
101
78
  summary: Extension of the Authlogic library adding RADIUS support.
102
79
  test_files: []
103
-