sixarm_ruby_sign_out 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/.gemtest +0 -0
- data/CHANGES.md +4 -0
- data/CONTRIBUTING.md +28 -0
- data/LICENSE.md +28 -0
- data/README.md +91 -0
- data/Rakefile +34 -0
- data/VERSION +1 -0
- data/lib/sixarm_ruby_sign_out.rb +63 -0
- data/test/sixarm_ruby_sign_out_test.rb +50 -0
- data.tar.gz.sig +0 -0
- metadata +93 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0c39431191e3abecf200ff0d967ad399540f7375
|
4
|
+
data.tar.gz: 9e301d75b1cfd9e6822e8f743aa7f5dae7a52eb7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61394aa86809472115313c5599abd1611d742ab861525fbbf4b531da6d26aa6b7184ff30506b4060c391f59a0be0a41ca996fe1f8b18e698650900933d1dd806
|
7
|
+
data.tar.gz: 116a21398b9d4416c7f94a43c0623211686ab75946de0c259e4cd1927cc2408905f539a9ed7d55649b7b6454d0fb0e8b4a738cc0b6d867e47ed2aa915495cb82
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/.gemtest
ADDED
File without changes
|
data/CHANGES.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Thank you for contributing!
|
4
|
+
|
5
|
+
If you would like to contribute a donation, an easy way is to use PayPal to sixarm@sixarm.com.
|
6
|
+
|
7
|
+
If you would like to contribute help, the next section is for you.
|
8
|
+
|
9
|
+
|
10
|
+
## Contributing to the source
|
11
|
+
|
12
|
+
We love pull requests for improvments to the source code and documentation.
|
13
|
+
|
14
|
+
There are three easy steps:
|
15
|
+
|
16
|
+
1. Fork the repo.
|
17
|
+
|
18
|
+
* Before you do any work please run our existing tests to make sure the code runs cleanly.
|
19
|
+
|
20
|
+
2. Work as you like.
|
21
|
+
|
22
|
+
* Please create tests. This helps us know that all your code runs cleanly.
|
23
|
+
|
24
|
+
3. Push to your fork and submit a pull request.
|
25
|
+
|
26
|
+
* We'll take a look as soon as we can; this is typically within a business day.
|
27
|
+
|
28
|
+
Thank you again!
|
data/LICENSE.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# License
|
2
|
+
|
3
|
+
You may choose any of these open source licenses:
|
4
|
+
|
5
|
+
* Apache License
|
6
|
+
* BSD License
|
7
|
+
* CreativeCommons License, Non-commercial Share Alike
|
8
|
+
* GNU Affero General Public License (AGPL)
|
9
|
+
* GNU General Public License Version (GPL)
|
10
|
+
* GNU Lesser General Public License (LGPL)
|
11
|
+
* MIT License
|
12
|
+
* Perl Artistic License
|
13
|
+
* Ruby License
|
14
|
+
|
15
|
+
The software is provided "as is", without warranty of any kind,
|
16
|
+
express or implied, including but not limited to the warranties of
|
17
|
+
merchantability, fitness for a particular purpose and noninfringement.
|
18
|
+
|
19
|
+
In no event shall the authors or copyright holders be liable for any
|
20
|
+
claim, damages or other liability, whether in an action of contract,
|
21
|
+
tort or otherwise, arising from, out of or in connection with the
|
22
|
+
software or the use or other dealings in the software.
|
23
|
+
|
24
|
+
This license is for the included software that is created by SixArm.
|
25
|
+
Some of the included software may have its own licenses, copyrights,
|
26
|
+
authors, etc. and these may take precedence over the SixArm license.
|
27
|
+
|
28
|
+
Copyright (c) Joel Parker Henderson
|
data/README.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# SixArm.com » Ruby » <br> SignOut interface for typical Rails user sign out
|
2
|
+
|
3
|
+
[](https://codeclimate.com/github/SixArm/sixarm_ruby_sign_out)
|
4
|
+
[](https://travis-ci.org/SixArm/sixarm_ruby_sign_out)
|
5
|
+
|
6
|
+
* Doc: <http://sixarm.com/sixarm_ruby_sign_out/doc>
|
7
|
+
* Gem: <http://rubygems.org/gems/sixarm_ruby_sign_out>
|
8
|
+
* Repo: <http://github.com/sixarm/sixarm_ruby_sign_out>
|
9
|
+
* Email: Joel Parker Henderson, <joel@sixarm.com>
|
10
|
+
|
11
|
+
|
12
|
+
## Introduction
|
13
|
+
|
14
|
+
Sign Out simple abstract framework.
|
15
|
+
|
16
|
+
You can include this module in your application controller,
|
17
|
+
then your controller can define any of these concrete methods.
|
18
|
+
|
19
|
+
For docs go to <http://sixarm.com/sixarm_ruby_sign_out/doc>
|
20
|
+
|
21
|
+
Want to help? We're happy to get pull requests.
|
22
|
+
|
23
|
+
|
24
|
+
## Install quickstart
|
25
|
+
|
26
|
+
Install:
|
27
|
+
|
28
|
+
gem install sixarm_ruby_sign_out
|
29
|
+
|
30
|
+
Bundler:
|
31
|
+
|
32
|
+
gem "sixarm_ruby_sign_out", ">=1.1.5", "<2"
|
33
|
+
|
34
|
+
Require:
|
35
|
+
|
36
|
+
require "sixarm_ruby_sign_out"
|
37
|
+
|
38
|
+
|
39
|
+
## Install with security (optional)
|
40
|
+
|
41
|
+
To enable high security for all our gems:
|
42
|
+
|
43
|
+
wget http://sixarm.com/sixarm.pem
|
44
|
+
gem cert --add sixarm.pem
|
45
|
+
gem sources --add http://sixarm.com
|
46
|
+
|
47
|
+
To install with high security:
|
48
|
+
|
49
|
+
gem install sixarm_ruby_sign_out --trust-policy HighSecurity
|
50
|
+
|
51
|
+
|
52
|
+
## Details
|
53
|
+
|
54
|
+
This provides one top-level method:
|
55
|
+
|
56
|
+
sign_out(options=nil) => true for success, false for failure
|
57
|
+
|
58
|
+
The top level method will call mid-level methods
|
59
|
+
that you will define in your own controller.
|
60
|
+
|
61
|
+
sign_out calls:
|
62
|
+
|
63
|
+
sign_out_attempt(options=nil), e.g. unset the current user
|
64
|
+
sign_out_success(options=nil), e.g. redirect to a goodbye page
|
65
|
+
sign_out_failure(options=nil), e.g. flash warning help message
|
66
|
+
|
67
|
+
|
68
|
+
## AuthLogic Example
|
69
|
+
|
70
|
+
AuthLogic provides this example:
|
71
|
+
|
72
|
+
def destroy
|
73
|
+
current_user_session.destroy
|
74
|
+
redirect_to new_user_session_url
|
75
|
+
end
|
76
|
+
|
77
|
+
The same example written using Sign Out to provide better structure and security:
|
78
|
+
|
79
|
+
def sign_out_attempt
|
80
|
+
current_user_session.destroy
|
81
|
+
current_user_session.frozen? or raise SecurityError, "Problem with sign out ... ", caller
|
82
|
+
end
|
83
|
+
|
84
|
+
def sign_out_success
|
85
|
+
redirect_to new_user_session_url
|
86
|
+
end
|
87
|
+
|
88
|
+
def sign_out_failure
|
89
|
+
# The AuthLogic example doesn't handle this case unfortunately;
|
90
|
+
# we should handle it because it indicates something is amiss.
|
91
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "rake"
|
3
|
+
require "rake/testtask"
|
4
|
+
|
5
|
+
Rake::TestTask.new(:test) do |t|
|
6
|
+
t.libs << 'lib' << 'test'
|
7
|
+
t.pattern = 'test/*.rb'
|
8
|
+
end
|
9
|
+
task :default => [:test]
|
10
|
+
task :default => [:test]
|
11
|
+
task :default => [:test]
|
12
|
+
task :default => [:test]
|
13
|
+
task :default => [:test]
|
14
|
+
task :default => [:test]
|
15
|
+
task :default => [:test]
|
16
|
+
task :default => [:test]
|
17
|
+
task :default => [:test]
|
18
|
+
task :default => [:test]
|
19
|
+
task :default => [:test]
|
20
|
+
task :default => [:test]
|
21
|
+
task :default => [:test]
|
22
|
+
task :default => [:test]
|
23
|
+
task :default => [:test]
|
24
|
+
task :default => [:test]
|
25
|
+
task :default => [:test]
|
26
|
+
task :default => [:test]
|
27
|
+
task :default => [:test]
|
28
|
+
task :default => [:test]
|
29
|
+
task :default => [:test]
|
30
|
+
task :default => [:test]
|
31
|
+
task :default => [:test]
|
32
|
+
task :default => [:test]
|
33
|
+
task :default => [:test]
|
34
|
+
task :default => [:test]
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.1.5
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin rdoc
|
3
|
+
Please see README
|
4
|
+
=end
|
5
|
+
|
6
|
+
|
7
|
+
module SignOut
|
8
|
+
|
9
|
+
|
10
|
+
# The sign_out method calls:
|
11
|
+
# - sign_out_attempt
|
12
|
+
# - sign_out_success (if sign_out_attempt returns true)
|
13
|
+
# - sign_out_failure (if sign_out_attempt returns false or raises a SecurityError)
|
14
|
+
|
15
|
+
def sign_out(options=nil)
|
16
|
+
begin
|
17
|
+
sign_out_attempt(options) or raise SecurityError
|
18
|
+
sign_out_success(options)
|
19
|
+
return true
|
20
|
+
rescue SecurityError
|
21
|
+
sign_out_failure(options)
|
22
|
+
return false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# The sign_out method calls this first.
|
28
|
+
#
|
29
|
+
# You override this method to e.g.:
|
30
|
+
# - prompt the user to save any of his open work
|
31
|
+
# - clear the current user variable
|
32
|
+
# - clear the current user id in the session
|
33
|
+
#
|
34
|
+
# If this method succeeds, then control goes to sign_out_success.
|
35
|
+
#
|
36
|
+
# If this method raises an error, then control goes to sign_out_failure.
|
37
|
+
|
38
|
+
def sign_out_attempt(options=nil)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
# The sign_out method calls this second,
|
43
|
+
# iff sign_out_attempt succeeds.
|
44
|
+
#
|
45
|
+
# You override this method to e.g.:
|
46
|
+
# - show the user a flash notice message saying "Goodbye..."
|
47
|
+
# - redirect to the application home page
|
48
|
+
|
49
|
+
def sign_out_success(options=nil)
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
# The sign_out method calls this second,
|
54
|
+
# iff sign_out_attempt raises an exception.
|
55
|
+
#
|
56
|
+
# You override this method to e.g.:
|
57
|
+
# - show the user a flash warning message saying "Problem..."
|
58
|
+
# - redirect to a help page with a way to report the problem
|
59
|
+
|
60
|
+
def sign_out_failure(options=nil)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "simplecov"
|
4
|
+
SimpleCov.start
|
5
|
+
require "sixarm_ruby_sign_out"
|
6
|
+
|
7
|
+
class SignOutTest < Minitest::Test
|
8
|
+
|
9
|
+
include SignOut
|
10
|
+
|
11
|
+
RIGHT=:foo
|
12
|
+
WRONG=:bar
|
13
|
+
|
14
|
+
def setup
|
15
|
+
@sign_out_attempt_seen=false
|
16
|
+
@sign_out_success_seen=false
|
17
|
+
@sign_out_failure_seen=false
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_sign_out_right
|
21
|
+
x=sign_out(RIGHT)
|
22
|
+
assert_equal(true,x,"sign_out x:#{x}")
|
23
|
+
assert( @sign_out_attempt_seen,"sign_out_attempt_seen")
|
24
|
+
assert( @sign_out_success_seen,"sign_out_success_seen")
|
25
|
+
assert(!@sign_out_failure_seen,"sign_out_failure_seen")
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_sign_out_wrong
|
29
|
+
x=sign_out(WRONG)
|
30
|
+
assert_equal(false,x,"sign_out x:#{x}")
|
31
|
+
assert( @sign_out_attempt_seen,"sign_out_attempt_seen")
|
32
|
+
assert(!@sign_out_success_seen,"sign_out_success_seen")
|
33
|
+
assert( @sign_out_failure_seen,"sign_out_failure_seen")
|
34
|
+
end
|
35
|
+
|
36
|
+
def sign_out_attempt(options=nil)
|
37
|
+
@sign_out_attempt_seen=true
|
38
|
+
if options==WRONG then raise SecurityError end
|
39
|
+
return options==RIGHT
|
40
|
+
end
|
41
|
+
|
42
|
+
def sign_out_success(options=nil)
|
43
|
+
@sign_out_success_seen=true
|
44
|
+
end
|
45
|
+
|
46
|
+
def sign_out_failure(options=nil)
|
47
|
+
@sign_out_failure_seen=true
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sixarm_ruby_sign_out
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SixArm
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIGCTCCA/GgAwIBAgIJAK3igyLv2hNNMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
|
14
|
+
BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp
|
15
|
+
c2NvMQ8wDQYDVQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb20wHhcNMTUw
|
16
|
+
MzE0MjA0MTE5WhcNMTcxMjA4MjA0MTE5WjBgMQswCQYDVQQGEwJVUzETMBEGA1UE
|
17
|
+
CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEPMA0GA1UEChMG
|
18
|
+
U2l4QXJtMRMwEQYDVQQDEwpzaXhhcm0uY29tMIICIjANBgkqhkiG9w0BAQEFAAOC
|
19
|
+
Ag8AMIICCgKCAgEA4et7SlePzuE46eK5BAVVGg+yWt6FkX7xcLt3Uun9RntKPSuR
|
20
|
+
TbS/+KBqbja5reZD64hdQ9npxpQPKafxUm+RlCd9F5KFxwi8G9usKzCTPOwUeDI2
|
21
|
+
TNEfC+1eRU19QuEW58ZC0pC/bx5Zmp6/DTD6VV+qxKEE9U1M5P85LNkwnxqmRIMR
|
22
|
+
AN8VKOG+GRGOMNDGZ8Kp4h5V3Wyu0N7anY8AUveIx1SyLrEbAhcWp1asLs+/H22q
|
23
|
+
92YFgnwTtnDpZsAmNgZrVw9xY0v79BXqPoyKIl2psPfZi2mOIWi/N+cx6LGF1G+B
|
24
|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iU7OCfE3u3baDpL
|
39
|
+
FlfMBznZKOdxDFAmNaxvXBe2XeTzrZPvJtnNLWL6K4LaBHhq3bBdh1Hge0iMkpQ7
|
40
|
+
RTIGlfhlIFkMV3wT0LTsNznUPsoo6e+IW/tDrk23mrNRY6QynTETb+QVIevuzD9m
|
41
|
+
Drcxp/zlVhud+a0ezdnyNvF520arJWvqA4GrOo8F+TT2vVrjscgYjiVGdSq+8wQv
|
42
|
+
Efa5jhe8QwG7R1rdpMMP5yBSAqWuFBczMveX5j4rp9Ifw5/XsZbgwcmdm26bjhzh
|
43
|
+
w2grAHIhvR9mztm6uXQlZhv1fu3P+RWHDSYhnZSCJSCdxPzQJ1mG5T5ahiL3HvCZ
|
44
|
+
2AC9FOGkybW6DJEFSFFMlNk0IILsa/gNp8ufGuTVLWF9FUUdMNK+TMbghnifT8/1
|
45
|
+
n+ES/gQPOnvmVkLDGw==
|
46
|
+
-----END CERTIFICATE-----
|
47
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
48
|
+
dependencies: []
|
49
|
+
description: Sign Out abstraction for a typical web app user
|
50
|
+
email: sixarm@sixarm.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- ".gemtest"
|
56
|
+
- CHANGES.md
|
57
|
+
- CONTRIBUTING.md
|
58
|
+
- LICENSE.md
|
59
|
+
- README.md
|
60
|
+
- Rakefile
|
61
|
+
- VERSION
|
62
|
+
- lib/sixarm_ruby_sign_out.rb
|
63
|
+
- test/sixarm_ruby_sign_out_test.rb
|
64
|
+
homepage: http://sixarm.com/
|
65
|
+
licenses:
|
66
|
+
- BSD
|
67
|
+
- GPL
|
68
|
+
- MIT
|
69
|
+
- PAL
|
70
|
+
- Various
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.4.8
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: SixArm.com » Ruby » Sign Out
|
92
|
+
test_files:
|
93
|
+
- test/sixarm_ruby_sign_out_test.rb
|
metadata.gz.sig
ADDED
Binary file
|