omniauth-pam 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # OmniAuth PAM
2
+
3
+ Allows you to authenticate against PAM using OmniAuth.
4
+
5
+ ## Usage
6
+
7
+ use OmniAuth:Strategies::PAM
8
+
9
+ There are no configuration options. It's been tested under Debian 6.0 and Ruby 1.9.3-p0, but there's no reason why it won't work anywhere which doesn't have PAM correctly configured.
10
+
11
+ Then navigate to '/auth/pam'.
12
+
13
+ On Debian/Ubuntu you will need the `libpam0g-dev` package to compile the [rpam](https://github.com/canweriotnow/rpam-ruby19) gem.Others, I don't know.
14
+
15
+ This strategy only supports Ruby 1.9. [Read here about 1.8 support](http://nickcharlton.net/post/pam-for-omniauth).
16
+
17
+ ## Author / License
18
+
19
+ Copyright Nick Charlton 2012. Licensed under the MIT license.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ # depends upon rpam
2
+ require "rpam"
3
+
4
+ # then the rest of the strategy
5
+ require "omniauth-pam/version"
6
+ require "omniauth/pam"
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module PAM
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+ module OmniAuth
2
+ module Strategies
3
+ class PAM
4
+ include OmniAuth::Strategy
5
+
6
+ option :fields, [:username]
7
+ option :uid_field, :username
8
+
9
+ def request_phase
10
+ OmniAuth::Form.build(
11
+ :title => (options[:title] || "Authenticate"),
12
+ :url => callback_path
13
+ ) do |field|
14
+ field.text_field 'Username', 'username'
15
+ field.password_field 'Password', 'password'
16
+ end.to_response
17
+ end
18
+
19
+ def callback_phase
20
+ unless Rpam.auth(request['username'], request['password'])
21
+ return fail!(:invalid_credentials)
22
+ end
23
+
24
+ super
25
+ end
26
+
27
+ uid do
28
+ request['username']
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-pam/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-pam"
7
+ s.version = OmniAuth::PAM::VERSION
8
+ s.authors = ["Nick Charlton"]
9
+ s.email = ["hello@nickcharlton.net"]
10
+ s.homepage = "https://github.com/nickcharlton/omniauth-pam"
11
+ s.summary = %q{A PAM strategy for OmniAuth.}
12
+ s.description = %q{A PAM strategy for OmniAuth.}
13
+
14
+ s.rubyforge_project = "omniauth-pam"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_runtime_dependency "omniauth", '~> 1.0'
22
+ s.add_runtime_dependency "rpam-ruby19"
23
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-pam
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Nick Charlton
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-01-15 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: omniauth
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 1
32
+ - 0
33
+ version: "1.0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rpam-ruby19
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ description: A PAM strategy for OmniAuth.
51
+ email:
52
+ - hello@nickcharlton.net
53
+ executables: []
54
+
55
+ extensions: []
56
+
57
+ extra_rdoc_files: []
58
+
59
+ files:
60
+ - .gitignore
61
+ - Gemfile
62
+ - README.md
63
+ - Rakefile
64
+ - lib/omniauth-pam.rb
65
+ - lib/omniauth-pam/version.rb
66
+ - lib/omniauth/stategies/pam.rb
67
+ - omniauth-pam.gemspec
68
+ has_rdoc: true
69
+ homepage: https://github.com/nickcharlton/omniauth-pam
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options: []
74
+
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
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:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project: omniauth-pam
98
+ rubygems_version: 1.6.2
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: A PAM strategy for OmniAuth.
102
+ test_files: []
103
+