rack-auth-kerberos 0.2.3 → 0.2.4
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/CHANGES +7 -0
- data/lib/rack/auth/kerberos.rb +18 -12
- data/rack-auth-kerberos.gemspec +1 -1
- data/test/test_rack_auth_kerberos.rb +1 -1
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
= 0.2.4 - 22-Apr-2010
|
2
|
+
* Krb5Auth::Krb5 object creation has been moved from the constructor into the
|
3
|
+
call method in order to guarantee a new object is used every time. This solves
|
4
|
+
a potential issue where krb5-auth would segfault if it tried to use an object
|
5
|
+
that had already been closed.
|
6
|
+
* Some minor documentation updates.
|
7
|
+
|
1
8
|
= 0.2.3 - 14-Jan-2010
|
2
9
|
* Resetting log with each call now, instead of initialize
|
3
10
|
|
data/lib/rack/auth/kerberos.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
require 'krb5_auth'
|
2
2
|
|
3
|
+
# The Rack module serves as a namespace only.
|
3
4
|
module Rack
|
5
|
+
|
6
|
+
# The Auth module serves as a namespace only.
|
4
7
|
module Auth
|
8
|
+
|
9
|
+
# The Kerberos class encapsulates kerberos authentication handling.
|
5
10
|
class Kerberos
|
6
11
|
# The version of the rack-auth-kerberos library.
|
7
|
-
VERSION = '0.2.
|
8
|
-
|
9
|
-
def log(msg)
|
10
|
-
@log << "\n #{msg}"
|
11
|
-
end
|
12
|
+
VERSION = '0.2.4'
|
12
13
|
|
13
14
|
# Creates a new Rack::Kerberos object. The +user_field+ and +password_field+
|
14
15
|
# are the params looked for in the call method. The defaults are 'username'
|
@@ -22,16 +23,11 @@ module Rack
|
|
22
23
|
# supply a username with or without a realm and it will Just Work (TM).
|
23
24
|
#
|
24
25
|
def initialize(app, user_field = 'username', password_field = 'password', realm = nil)
|
26
|
+
@kerberos = nil
|
25
27
|
@app = app
|
26
28
|
@user_field = user_field
|
27
29
|
@password_field = password_field
|
28
|
-
@
|
29
|
-
|
30
|
-
if realm
|
31
|
-
@realm = realm
|
32
|
-
else
|
33
|
-
@realm = @kerberos.get_default_realm
|
34
|
-
end
|
30
|
+
@realm = realm
|
35
31
|
end
|
36
32
|
|
37
33
|
# The call method we've defined first checks to see if the AUTH_USER
|
@@ -56,6 +52,9 @@ module Rack
|
|
56
52
|
# AUTH_DATETIME => Time.now.utc
|
57
53
|
#
|
58
54
|
def call(env)
|
55
|
+
@kerberos = Krb5Auth::Krb5.new
|
56
|
+
@realm ||= @kerberos.get_default_realm
|
57
|
+
|
59
58
|
@log = "Entering Rack::Auth::Kerberos"
|
60
59
|
request = Rack::Request.new(env)
|
61
60
|
|
@@ -63,6 +62,7 @@ module Rack
|
|
63
62
|
password = request.params[@password_field]
|
64
63
|
|
65
64
|
log "Kerberos user: #{user}, password length: #{password.nil? ? 'nil' : password.size}"
|
65
|
+
|
66
66
|
# Only authenticate user if both the username and password fields are present
|
67
67
|
unless user && password
|
68
68
|
return @app.call(env)
|
@@ -113,6 +113,12 @@ module Rack
|
|
113
113
|
env['AUTH_LOG'] = @log
|
114
114
|
@app.call(env)
|
115
115
|
end
|
116
|
+
|
117
|
+
# Append a +msg+ to a @log string that can be used for logging & debugging.
|
118
|
+
#
|
119
|
+
def log(msg)
|
120
|
+
@log << "\n #{msg}"
|
121
|
+
end
|
116
122
|
end
|
117
123
|
end
|
118
124
|
end
|
data/rack-auth-kerberos.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'rack-auth-kerberos'
|
5
|
-
gem.version = '0.2.
|
5
|
+
gem.version = '0.2.4'
|
6
6
|
gem.authors = ["Daniel Berger", "Charlie O'Keefe", "Marty Haught"]
|
7
7
|
gem.email = 'dberger@globe.gov'
|
8
8
|
gem.homepage = 'http://www.github.com/rack-kerberos'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-auth-kerberos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Berger
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-
|
14
|
+
date: 2010-04-22 00:00:00 -06:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|