casino-test_authenticator 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YWY0YTUyYzM0N2NhODU5Mjk3OTBkYWNhZDY1M2IxMjg3NjQ5M2UzOA==
5
+ data.tar.gz: !binary |-
6
+ NTkwMWQ1MTMxOWEyYmM4ZjhmNmE3Y2FiZTExOTM1MGQ5OTlkYWVkYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDkyZGM5MmMwZWE2NDEzM2ExMzJhZWE4NmI4N2RmOTk1ZWJjZTk1NjYzN2Rh
10
+ NDE4NTYyZDRlODcwM2ZkZGRmNGE1YTk1YWQ5ODJhZjI4ZWRiY2E5YjlmYTMw
11
+ Zjk3ZjYxZWJiMGQ1NDZhY2Y2ZWRkNGVkODgxODVjOTNhZTFjMTQ=
12
+ data.tar.gz: !binary |-
13
+ MjI1MDFjNGFkYjdiNTY5ZWQ4YjY2N2Q4YTQ4Mzk1NThkYjg3OGI1ZjkwZTll
14
+ ZWMxNjFhYWQ2YWZkOTI0OWE3NWNjZGNhOGUyMTk2NTJmYmI2YTQzNzE5ZmRl
15
+ YjYxYWM0OTBlNmU3ZDAxZjZmMTZiY2U4NGVkOTFiNDlhNTRiNDc=
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ # rcov generated
2
+ coverage
3
+ coverage.data
4
+
5
+ # bundler
6
+ .bundle
7
+
8
+ Gemfile.lock
9
+ /pkg
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --format documentation
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ casino-test_authenticator
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p194
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Andrew Beresford
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # casino-test_authenticator [![Build Status](https://travis-ci.org/beezly/casino-test_authenticator.png?branch=master)](https://travis-ci.org/beezly/casino-test_authenticator) [![Coverage Status](https://coveralls.io/repos/beezly/casino-test_authenticator/badge.png)](https://coveralls.io/r/beezly/casino-test_authenticator)Provides a test authenticator for [CASino](https://github.com/rbCAS/CASino).
2
+
3
+ The test authenticator will validate a user if the username and password match.
4
+
5
+ **The test authenticator should only be used in environments where you do not care about security**
6
+
7
+ To use the test authenticator, configure it in your cas.yml:
8
+
9
+ authenticators:
10
+ test_authenticator:
11
+ authenticator: "Test"
12
+ options:
13
+
14
+ Currently there are no options.
15
+
16
+ ## Contributing to casino-test_authenticator
17
+
18
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
19
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
20
+ * Fork the project.
21
+ * Start a feature/bugfix branch.
22
+ * Commit and push until you are happy with your contribution.
23
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
24
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
25
+
26
+ ## Copyright
27
+
28
+ Copyright (c) 2014 Andrew Beresford. See LICENSE.txt
29
+ for further details.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler'
2
+ require 'rake'
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ task :default => :spec
7
+
8
+ desc 'Run all specs'
9
+ RSpec::Core::RakeTask.new(:spec) do |spec|
10
+ spec.pattern = FileList['spec/**/*_spec.rb']
11
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'casino/test_authenticator/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'casino-test_authenticator'
7
+ s.version = CASino::TestAuthenticator::VERSION
8
+ s.authors = ['Andrew Beresford']
9
+ s.email = ['beezly@beezly.org.uk']
10
+ s.homepage = 'http://github.com/beezly/casino-test_authenticator/'
11
+ s.license = 'MIT'
12
+ s.summary = 'Provides a basic test authenticator for CASino.'
13
+ s.description = 'This gem can be used to allow the CASino backend to authenticate without any backend services.'
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ['lib']
19
+
20
+ s.add_development_dependency 'rake', '~> 10.0'
21
+ s.add_development_dependency 'rspec', '~> 2.12'
22
+ s.add_development_dependency 'simplecov', '~> 0.7'
23
+ s.add_development_dependency 'coveralls', '~> 0'
24
+
25
+ s.add_runtime_dependency 'casino', '~> 2.0'
26
+ end
@@ -0,0 +1,2 @@
1
+ require 'casino/test_authenticator/version'
2
+ require 'casino/test_authenticator'
@@ -0,0 +1,31 @@
1
+ require 'casino/authenticator'
2
+
3
+ class CASino::TestAuthenticator
4
+ # @param [Hash] options
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def validate(username, password)
10
+ @username = username
11
+ @password = password
12
+ if username != password
13
+ false
14
+ else
15
+ generate_user
16
+ @user
17
+ end
18
+ end
19
+
20
+ private
21
+ def generate_user
22
+ @user = {
23
+ username: @username,
24
+ extra_attributes: extra_attributes
25
+ }
26
+ end
27
+
28
+ def extra_attributes
29
+ nil
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ module CASino
2
+ class TestAuthenticator
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+ require 'casino/test_authenticator'
3
+
4
+ describe CASino::TestAuthenticator do
5
+ let(:options) { { } }
6
+ let(:subject) { described_class.new(options) }
7
+ let(:connection) { Object.new }
8
+
9
+
10
+ describe '#validate' do
11
+ let(:username) { 'test' }
12
+
13
+ context 'when validation succeeds' do
14
+ let(:password) { 'test' }
15
+ it 'returns the user data' do
16
+ subject.validate(username, password).should == {
17
+ username: username,
18
+ extra_attributes: nil
19
+ }
20
+ end
21
+ end
22
+
23
+ context 'when validation fails' do
24
+ let(:password) { 'foo' }
25
+ it 'returns false' do
26
+ subject.validate(username, password).should == false
27
+ end
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'simplecov'
5
+ require 'coveralls'
6
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
7
+ SimpleCov.start do
8
+ add_filter '/spec'
9
+ end
10
+
11
+ require 'rspec'
12
+ require 'casino-test_authenticator'
13
+
14
+ # Requires supporting files with custom matchers and macros, etc,
15
+ # in ./support/ and its subdirectories.
16
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
17
+
18
+ RSpec.configure do |config|
19
+ # Run specs in random order to surface order dependencies. If you find an
20
+ # order dependency and want to debug it, you can fix the order by providing
21
+ # the seed, which is printed after each run.
22
+ # --seed 1234
23
+ config.order = 'random'
24
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: casino-test_authenticator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Beresford
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '10.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '10.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '2.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '2.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '0.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: casino
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ description: This gem can be used to allow the CASino backend to authenticate without
84
+ any backend services.
85
+ email:
86
+ - beezly@beezly.org.uk
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - .rspec
93
+ - .ruby-gemset
94
+ - .ruby-version
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - casino-test_authenticator.gemspec
100
+ - lib/casino-test_authenticator.rb
101
+ - lib/casino/test_authenticator.rb
102
+ - lib/casino/test_authenticator/version.rb
103
+ - spec/casino/test_authenticator_spec.rb
104
+ - spec/spec_helper.rb
105
+ homepage: http://github.com/beezly/casino-test_authenticator/
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.2.2
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Provides a basic test authenticator for CASino.
129
+ test_files:
130
+ - spec/casino/test_authenticator_spec.rb
131
+ - spec/spec_helper.rb