omniauth-kerberos 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-kerberos.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Jan Graichen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Omniauth::Strategies::Kerberos
2
+
3
+ **omniauth-kerberos** is a simple [OmniAuth](https://github.com/intridea/omniauth)
4
+ strategy to authenticate using a Kerberos server. **omniauth-kerberos** can be used as
5
+ a authenticator for [OmniAuth MultiPassword](https://github.com/jgraichen/omniauth-multipassword).
6
+
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'omniauth-kerberos'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install omniauth-kerberos
21
+
22
+ Kerberos development headers are required to build dependencies.
23
+
24
+ On Debian try:
25
+
26
+ $ sudo apt-get install libkrb5-dev
27
+
28
+
29
+ ## Usage
30
+
31
+ Use **omniauth-kerberos** like any other OmniAuth strategy:
32
+
33
+ ```ruby
34
+ Rails.application.config.middleware.use OmniAuth::Builder do
35
+ provider :kerberos
36
+ end
37
+ ```
38
+
39
+ You still need to configure your system for Kerberos usage like
40
+ specifying realms. If you has your own login form you can specify
41
+ the fields to use:
42
+
43
+ ```ruby
44
+ Rails.application.config.middleware.use OmniAuth::Builder do
45
+ provider :kerberos, :fields => [ :login, :pwd ]
46
+ end
47
+ ```
48
+
49
+
50
+ ## Options
51
+
52
+ ** title **
53
+ The title text shown on default login form.
54
+ (default: `"Restricted Access"`)
55
+
56
+ ** fields **
57
+ The request parameter names to fetch username and password.
58
+ (default: `[ "username", "password" ]`)
59
+
60
+
61
+ ## License
62
+
63
+ [MIT License](http://www.opensource.org/licenses/mit-license.php)
64
+
65
+ Copyright (c) 2012, Jan Graichen
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ require "omniauth/strategies/kerberos"
@@ -0,0 +1,28 @@
1
+ require "omniauth"
2
+ require "krb5_auth"
3
+ require "omniauth/multipassword/base"
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class Kerberos
8
+ include OmniAuth::Strategy
9
+ include OmniAuth::MultiPassword::Base
10
+
11
+ def initialize(app, *args, &block)
12
+ super
13
+ @krb5 = ::Krb5Auth::Krb5.new
14
+ end
15
+
16
+ info do
17
+ { username: username,
18
+ email: username + "@" + @krb5.get_default_realm }
19
+ end
20
+
21
+ def authenticate(username, password)
22
+ @krb5.get_init_creds_password(username, password)
23
+ rescue ::Krb5Auth::Krb5::Exception
24
+ false
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Jan Graichen"]
5
+ gem.email = ["jan.graichen@altimos.de"]
6
+ gem.description = "An OmniAuth strategy for Kerberos."
7
+ gem.summary = "An OmniAuth strategy for Kerberos."
8
+ gem.homepage = "https://github.com/jgraichen/omniauth-kerberos"
9
+
10
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
11
+ gem.files = `git ls-files`.split("\n")
12
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
+ gem.name = "omniauth-kerberos"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = "0.1.0"
16
+
17
+ gem.add_dependency "timfel-krb5-auth", "~> 0.8"
18
+ gem.add_dependency "omniauth-multipassword"
19
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-kerberos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jan Graichen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: timfel-krb5-auth
16
+ requirement: &4880160 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.8'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *4880160
25
+ - !ruby/object:Gem::Dependency
26
+ name: omniauth-multipassword
27
+ requirement: &4893900 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *4893900
36
+ description: An OmniAuth strategy for Kerberos.
37
+ email:
38
+ - jan.graichen@altimos.de
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - LICENSE
46
+ - README.md
47
+ - Rakefile
48
+ - lib/omniauth-kerberos.rb
49
+ - lib/omniauth/strategies/kerberos.rb
50
+ - omniauth-kerberos.gemspec
51
+ homepage: https://github.com/jgraichen/omniauth-kerberos
52
+ licenses: []
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 1.8.15
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: An OmniAuth strategy for Kerberos.
75
+ test_files: []