warden_skeleton_key 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/lib/warden_skeleton_key/version.rb +3 -0
- data/lib/warden_skeleton_key.rb +49 -0
- data/warden_skeleton_key.gemspec +22 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9ff0abb543519b064f407594bc6e7368f7014567
|
4
|
+
data.tar.gz: ec1318a83f355eda26e905318e4319bc91f8328d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d0b73af9c2a4f6165e72155e2ed8e19813192ab5282d75103c29aaa616a57d3d904d6a8e9ae3eacf3a23935801fabc610a2ddda7b0da15b6392b8faf2f22928f
|
7
|
+
data.tar.gz: 8178b09be2d0840cefae0f600d9cc7641e8b852702fc5710d04b959d698900dd34424f43e70b251bf97558d46d843503f5b27ffdaf7962658a1d926502da8d9c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 richard
|
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,31 @@
|
|
1
|
+
# WardenSkeletonKey
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'warden_skeleton_key'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install warden_skeleton_key
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/warden_skeleton_key/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
class WardenSkeletonKey
|
2
|
+
# Middleware to automatically sign in users.
|
3
|
+
#
|
4
|
+
# NOTE: Only intended to run in test or development environments!
|
5
|
+
#
|
6
|
+
# user_finder - Required block that returns a user object to sign in.
|
7
|
+
#
|
8
|
+
# Example
|
9
|
+
#
|
10
|
+
# # config/environments/development.rb
|
11
|
+
#
|
12
|
+
# Application.configure do
|
13
|
+
# config.middleware.use WardenSkeletonKey do
|
14
|
+
# AdminUser.find_by email: 'admin@example.com'
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
def initialize(app, &user_finder)
|
19
|
+
perform_safety_check
|
20
|
+
@app, @user_finder = app, user_finder
|
21
|
+
end
|
22
|
+
|
23
|
+
def call(env)
|
24
|
+
@env = env
|
25
|
+
sign_in unless signed_in?
|
26
|
+
@app.call(@env)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def user
|
32
|
+
@user_finder.call
|
33
|
+
end
|
34
|
+
|
35
|
+
def sign_in
|
36
|
+
@env['warden'].set_user(user)
|
37
|
+
end
|
38
|
+
|
39
|
+
def signed_in?
|
40
|
+
!@env['warden'].user.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
def perform_safety_check
|
44
|
+
if defined? Rails
|
45
|
+
fail 'This is probably a mistake, but you do NOT want this running in production.' if Rails.env.production?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'warden_skeleton_key/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "warden_skeleton_key"
|
8
|
+
spec.version = WardenSkeletonKey::VERSION
|
9
|
+
spec.authors = ["Richard Caverly", "Charles Maresh"]
|
10
|
+
spec.email = ["richard.caverly@orm-tech.com", "charles.maresh@orm-tech.com"]
|
11
|
+
spec.summary = %q{Warden Skeleton Key}
|
12
|
+
spec.description = %q{Warden Skeleton Key}
|
13
|
+
spec.homepage = ""
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
# spec.add_development_dependency "bundler", "~> 1.7"
|
21
|
+
# spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: warden_skeleton_key
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Caverly
|
8
|
+
- Charles Maresh
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-10-10 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Warden Skeleton Key
|
15
|
+
email:
|
16
|
+
- richard.caverly@orm-tech.com
|
17
|
+
- charles.maresh@orm-tech.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- lib/warden_skeleton_key.rb
|
28
|
+
- lib/warden_skeleton_key/version.rb
|
29
|
+
- warden_skeleton_key.gemspec
|
30
|
+
homepage: ''
|
31
|
+
licenses: []
|
32
|
+
metadata: {}
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.0.14
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Warden Skeleton Key
|
53
|
+
test_files: []
|