omniauth-kerberos 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +11 -0
- data/Gemfile +5 -0
- data/README.md +6 -6
- data/Rakefile +5 -1
- data/lib/omniauth-kerberos.rb +1 -1
- data/lib/omniauth/strategies/kerberos.rb +4 -4
- data/omniauth-kerberos.gemspec +11 -11
- data/spec/omniauth/strategy/kerberos_spec.rb +46 -0
- data/spec/spec_helper.rb +28 -0
- metadata +26 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0ab31e63741bc6081a1ac585aa3e028a1b7df828
|
4
|
+
data.tar.gz: 58951311487178e942484b18364e3ca1c427980d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b84a53ec922f86be59b43d7398ea23c0ad1469898d4eaccc07c187a5130bfada6bc39ea7c965441c07edbb2ade157b283db2c15d7269257e416de96cf566147e
|
7
|
+
data.tar.gz: edb5427c2c66a5398b697d4dc1fea3df0214a8e34a5a59ca6e12c1737cb72d277910ce97506fdb233c5fd3618262c13bb03db42d7bddc62358528e5edc203879
|
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- '2.1'
|
6
|
+
- '2.0'
|
7
|
+
- 1.9.3
|
8
|
+
- rbx-2
|
9
|
+
env:
|
10
|
+
global:
|
11
|
+
secure: GFgbyRIlAc93IyH5clByNGS9iI/5OSaa2Ba0iGemyLR93I80qxIUNgMvXzp74YTTbGTrWyz9JPBSD14uO/3tuPYhXuawbDT0k1D/97Xm7wMhxLXZNSEATKt71g3bk/106fy+ULz6aqzQWnLkGHsvfg3vlkdyn8rX/X1HstajrcI=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Omniauth::Strategies::Kerberos
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/jgraichen/omniauth-kerberos.svg)](https://travis-ci.org/jgraichen/omniauth-kerberos)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/jgraichen/omniauth-kerberos/badges/gpa.svg)](https://codeclimate.com/github/jgraichen/omniauth-kerberos)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/jgraichen/omniauth-kerberos/badges/coverage.svg)](https://codeclimate.com/github/jgraichen/omniauth-kerberos/coverage)
|
6
|
+
|
7
|
+
**omniauth-kerberos** is a simple [OmniAuth](https://github.com/intridea/omniauth) strategy to authenticate using a Kerberos server. **omniauth-kerberos** can be used as an authenticator for [OmniAuth MultiPassword](https://github.com/jgraichen/omniauth-multipassword).
|
6
8
|
|
7
9
|
|
8
10
|
## Installation
|
@@ -36,9 +38,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
36
38
|
end
|
37
39
|
```
|
38
40
|
|
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:
|
41
|
+
You still need to configure your system for Kerberos usage like specifying realms. If you has your own login form you can specify the fields to use:
|
42
42
|
|
43
43
|
```ruby
|
44
44
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
data/Rakefile
CHANGED
data/lib/omniauth-kerberos.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require 'omniauth/strategies/kerberos'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'omniauth'
|
2
|
+
require 'krb5_auth'
|
3
|
+
require 'omniauth/multipassword/base'
|
4
4
|
|
5
5
|
module OmniAuth
|
6
6
|
module Strategies
|
@@ -15,7 +15,7 @@ module OmniAuth
|
|
15
15
|
|
16
16
|
info do
|
17
17
|
{ username: username,
|
18
|
-
email: username +
|
18
|
+
email: username + '@' + @krb5.get_default_realm.downcase }
|
19
19
|
end
|
20
20
|
|
21
21
|
def authenticate(username, password)
|
data/omniauth-kerberos.gemspec
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.authors = [
|
5
|
-
gem.email = [
|
6
|
-
gem.description =
|
7
|
-
gem.summary =
|
8
|
-
gem.homepage =
|
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
9
|
|
10
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
10
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
11
11
|
gem.files = `git ls-files`.split("\n")
|
12
12
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
13
|
-
gem.name =
|
14
|
-
gem.require_paths = [
|
15
|
-
gem.version =
|
13
|
+
gem.name = 'omniauth-kerberos'
|
14
|
+
gem.require_paths = ['lib']
|
15
|
+
gem.version = '0.3.0'
|
16
16
|
|
17
|
-
gem.add_dependency
|
18
|
-
gem.add_dependency
|
17
|
+
gem.add_dependency 'timfel-krb5-auth', '~> 0.8'
|
18
|
+
gem.add_dependency 'omniauth-multipassword'
|
19
19
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rack/test'
|
3
|
+
|
4
|
+
describe OmniAuth::Strategies::Kerberos do
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
before do
|
8
|
+
fake = double 'krb5'
|
9
|
+
allow(::Krb5Auth::Krb5).to receive(:new).and_return fake
|
10
|
+
|
11
|
+
allow(fake).to receive(:get_default_realm).and_return 'example.org'
|
12
|
+
|
13
|
+
allow(fake).to receive(:get_init_creds_password) do |username, password|
|
14
|
+
if username == 'john' && password == 'secret'
|
15
|
+
true
|
16
|
+
else
|
17
|
+
fail ::Krb5Auth::Krb5::Exception
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:app) do
|
23
|
+
Rack::Builder.new do
|
24
|
+
use OmniAuth::Test::PhonySession
|
25
|
+
use OmniAuth::Strategies::Kerberos
|
26
|
+
run ->(env) { [404, {}, [env['omniauth.auth']['uid'].to_s]] }
|
27
|
+
end.to_app
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'shows login FORM' do
|
31
|
+
get '/auth/kerberos'
|
32
|
+
expect(last_response.body).to include '<form'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'redirect on wrong password' do
|
36
|
+
post '/auth/kerberos/callback', username: 'paul', password: 'wrong'
|
37
|
+
expect(last_response).to be_redirect
|
38
|
+
expect(last_response.headers['Location']).to eq \
|
39
|
+
'/auth/failure?message=invalid_credentials&strategy=kerberos'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'authenticates with password' do
|
43
|
+
post '/auth/kerberos/callback', username: 'john', password: 'secret'
|
44
|
+
expect(last_response.body).to eq 'john'
|
45
|
+
end
|
46
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
if ENV['CI'] || (defined?(:RUBY_ENGINE) && RUBY_ENGINE != 'rbx')
|
4
|
+
begin
|
5
|
+
require 'codeclimate-test-reporter'
|
6
|
+
CodeClimate::TestReporter.start
|
7
|
+
rescue LoadError
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'omniauth-kerberos'
|
12
|
+
|
13
|
+
Dir[File.expand_path('spec/support/**/*.rb')].each { |f| require f }
|
14
|
+
|
15
|
+
# Disable omniauth logger
|
16
|
+
class NullLogger < Logger
|
17
|
+
def initialize(*_args)
|
18
|
+
end
|
19
|
+
|
20
|
+
def add(*_args, &_block)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
OmniAuth.config.logger = NullLogger.new
|
25
|
+
|
26
|
+
RSpec.configure do |config|
|
27
|
+
config.order = 'random'
|
28
|
+
end
|
metadata
CHANGED
@@ -1,38 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-kerberos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jan Graichen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: timfel-krb5-auth
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0.8'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.8'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: omniauth-multipassword
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
36
41
|
description: An OmniAuth strategy for Kerberos.
|
37
42
|
email:
|
38
43
|
- jan.graichen@altimos.de
|
@@ -40,7 +45,8 @@ executables: []
|
|
40
45
|
extensions: []
|
41
46
|
extra_rdoc_files: []
|
42
47
|
files:
|
43
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
44
50
|
- Gemfile
|
45
51
|
- LICENSE
|
46
52
|
- README.md
|
@@ -48,28 +54,30 @@ files:
|
|
48
54
|
- lib/omniauth-kerberos.rb
|
49
55
|
- lib/omniauth/strategies/kerberos.rb
|
50
56
|
- omniauth-kerberos.gemspec
|
57
|
+
- spec/omniauth/strategy/kerberos_spec.rb
|
58
|
+
- spec/spec_helper.rb
|
51
59
|
homepage: https://github.com/jgraichen/omniauth-kerberos
|
52
60
|
licenses: []
|
61
|
+
metadata: {}
|
53
62
|
post_install_message:
|
54
63
|
rdoc_options: []
|
55
64
|
require_paths:
|
56
65
|
- lib
|
57
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
67
|
requirements:
|
60
|
-
- -
|
68
|
+
- - ">="
|
61
69
|
- !ruby/object:Gem::Version
|
62
70
|
version: '0'
|
63
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
72
|
requirements:
|
66
|
-
- -
|
73
|
+
- - ">="
|
67
74
|
- !ruby/object:Gem::Version
|
68
75
|
version: '0'
|
69
76
|
requirements: []
|
70
77
|
rubyforge_project:
|
71
|
-
rubygems_version:
|
78
|
+
rubygems_version: 2.4.6
|
72
79
|
signing_key:
|
73
|
-
specification_version:
|
80
|
+
specification_version: 4
|
74
81
|
summary: An OmniAuth strategy for Kerberos.
|
75
82
|
test_files: []
|
83
|
+
has_rdoc:
|