omniauth-pam 1.0.0 → 1.1.0
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/README.md +16 -5
- data/lib/omniauth-pam.rb +3 -2
- data/lib/omniauth-pam/version.rb +1 -1
- data/lib/omniauth/{stategies → strategies}/pam.rb +26 -1
- data/omniauth-pam.gemspec +2 -1
- metadata +21 -16
data/README.md
CHANGED
@@ -6,14 +6,25 @@ Allows you to authenticate against PAM using OmniAuth.
|
|
6
6
|
|
7
7
|
use OmniAuth:Strategies::PAM
|
8
8
|
|
9
|
-
There are no configuration options. It's been tested under Debian 6.0
|
9
|
+
There are no configuration options. It's been tested under Debian 6.0 (Squeeze)
|
10
|
+
and Ruby 1.9.3, but there's no reason why it won't work anywhere which doesn't
|
11
|
+
have PAM correctly configured.
|
12
|
+
_Note: The above is assumed for Sinatra, check the OmniAuth docs for Rails, et. al. usage._
|
10
13
|
|
11
14
|
Then navigate to '/auth/pam'.
|
12
15
|
|
13
|
-
On Debian/Ubuntu you will need the `libpam0g-dev` package to compile the [rpam]
|
16
|
+
On Debian/Ubuntu you will need the `libpam0g-dev` package to compile the [rpam][]
|
17
|
+
gem. YMMV with others.
|
14
18
|
|
15
|
-
This strategy only supports Ruby 1.9. [Read here about 1.8 support]
|
19
|
+
This strategy only supports Ruby 1.9. [Read here about 1.8 support][oldruby].
|
16
20
|
|
17
|
-
##
|
21
|
+
## Credits
|
22
|
+
|
23
|
+
Originally hacked together by [Nick Charlton][nick], with modifications by
|
24
|
+
[Jaakko Kantojärvi][jaakko] for GitLab support. Licensed under the MIT license.
|
25
|
+
|
26
|
+
[rpam]: https://github.com/canweriotnow/rpam-ruby19
|
27
|
+
[oldruby]: http://nickcharlton.net/post/pam-for-omniauth
|
28
|
+
[nick]: https://github.com/nickcharlton
|
29
|
+
[jaakko]: https://github.com/raphendyr
|
18
30
|
|
19
|
-
Copyright Nick Charlton 2012. Licensed under the MIT license.
|
data/lib/omniauth-pam.rb
CHANGED
data/lib/omniauth-pam/version.rb
CHANGED
@@ -6,6 +6,9 @@ module OmniAuth
|
|
6
6
|
option :fields, [:username]
|
7
7
|
option :uid_field, :username
|
8
8
|
|
9
|
+
# this map is used to return gecos in info
|
10
|
+
option :gecos_map, [:name, :location, :phone, :home_phone, :description]
|
11
|
+
|
9
12
|
def request_phase
|
10
13
|
OmniAuth::Form.build(
|
11
14
|
:title => (options[:title] || "Authenticate"),
|
@@ -17,16 +20,38 @@ module OmniAuth
|
|
17
20
|
end
|
18
21
|
|
19
22
|
def callback_phase
|
20
|
-
|
23
|
+
rpam_opts = Hash.new
|
24
|
+
rpam_opts[:service] = options[:service] unless options[:service].nil?
|
25
|
+
|
26
|
+
unless Rpam.auth(request['username'], request['password'], rpam_opts)
|
21
27
|
return fail!(:invalid_credentials)
|
22
28
|
end
|
23
29
|
|
24
30
|
super
|
25
31
|
end
|
26
32
|
|
33
|
+
def parse_gecos
|
34
|
+
if options[:gecos_map].kind_of?(Array)
|
35
|
+
begin
|
36
|
+
gecos = Etc.getpwnam(uid).gecos.split(',')
|
37
|
+
Hash[options[:gecos_map].zip(gecos)].delete_if { |k, v| v.nil? }
|
38
|
+
rescue
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
27
43
|
uid do
|
28
44
|
request['username']
|
29
45
|
end
|
46
|
+
|
47
|
+
info do
|
48
|
+
{
|
49
|
+
:nickname => uid,
|
50
|
+
:name => uid
|
51
|
+
}.merge!(parse_gecos)
|
52
|
+
end
|
30
53
|
end
|
31
54
|
end
|
32
55
|
end
|
56
|
+
|
57
|
+
OmniAuth.config.add_camelization 'pam', 'PAM'
|
data/omniauth-pam.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-pam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
7
|
+
- 1
|
8
8
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
9
|
+
version: 1.1.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Nick Charlton
|
@@ -15,18 +14,16 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2013-02-26 00:00:00 +00:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: omniauth
|
23
22
|
prerelease: false
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
25
|
- - ~>
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 15
|
30
27
|
segments:
|
31
28
|
- 1
|
32
29
|
- 0
|
@@ -37,16 +34,28 @@ dependencies:
|
|
37
34
|
name: rpam-ruby19
|
38
35
|
prerelease: false
|
39
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 1
|
42
|
+
- 2
|
43
|
+
- 1
|
44
|
+
version: 1.2.1
|
45
|
+
type: :runtime
|
46
|
+
version_requirements: *id002
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: etc
|
49
|
+
prerelease: false
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
51
|
requirements:
|
42
52
|
- - ">="
|
43
53
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 3
|
45
54
|
segments:
|
46
55
|
- 0
|
47
56
|
version: "0"
|
48
57
|
type: :runtime
|
49
|
-
version_requirements: *
|
58
|
+
version_requirements: *id003
|
50
59
|
description: A PAM strategy for OmniAuth.
|
51
60
|
email:
|
52
61
|
- hello@nickcharlton.net
|
@@ -63,7 +72,7 @@ files:
|
|
63
72
|
- Rakefile
|
64
73
|
- lib/omniauth-pam.rb
|
65
74
|
- lib/omniauth-pam/version.rb
|
66
|
-
- lib/omniauth/
|
75
|
+
- lib/omniauth/strategies/pam.rb
|
67
76
|
- omniauth-pam.gemspec
|
68
77
|
has_rdoc: true
|
69
78
|
homepage: https://github.com/nickcharlton/omniauth-pam
|
@@ -75,27 +84,23 @@ rdoc_options: []
|
|
75
84
|
require_paths:
|
76
85
|
- lib
|
77
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
87
|
requirements:
|
80
88
|
- - ">="
|
81
89
|
- !ruby/object:Gem::Version
|
82
|
-
hash: 3
|
83
90
|
segments:
|
84
91
|
- 0
|
85
92
|
version: "0"
|
86
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
94
|
requirements:
|
89
95
|
- - ">="
|
90
96
|
- !ruby/object:Gem::Version
|
91
|
-
hash: 3
|
92
97
|
segments:
|
93
98
|
- 0
|
94
99
|
version: "0"
|
95
100
|
requirements: []
|
96
101
|
|
97
102
|
rubyforge_project: omniauth-pam
|
98
|
-
rubygems_version: 1.6
|
103
|
+
rubygems_version: 1.3.6
|
99
104
|
signing_key:
|
100
105
|
specification_version: 3
|
101
106
|
summary: A PAM strategy for OmniAuth.
|