devise-login-cookie 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in devise-login-cookie.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ devise-login-cookie
2
+ ===================
3
+
4
+ An extension for Devise which sets a signed login cookie upon authentication, making shared logins between same-domain applications possible.
5
+
6
+
7
+ Installation
8
+ ------------
9
+
10
+ # TODO: publish gem so this works:
11
+ gem install devise-login-cookie
12
+
13
+ echo 'gem "devise-login-cookie"' >> Gemfile
14
+ bundle install
15
+
16
+ # load in config/initializers/devise
17
+ require 'devise-login-cookie'
18
+
19
+
20
+ Information
21
+ -----------
22
+
23
+ While Devise sets a cookie for Remember Me logins, standard logins are only tracked in the session.
24
+ This extension sets a separate cookie upon authentication.
25
+
26
+
27
+ TODO
28
+ ----
29
+
30
+ * Cookie is being set on signin; need to delete on signout.
31
+ * Cookie is write-only; create a Warden strategy to consume cookie for login.
32
+ * Rails signed cookies use Marshal.dump; implement a simpler cross-platform HMAC signing.
33
+
34
+
35
+ Meh
36
+ ---
37
+
38
+ (c) 2010 Paul Annesley, MIT license.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "devise-login-cookie/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "devise-login-cookie"
7
+ s.version = DeviseLoginCookie::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Paul Annesley"]
10
+ s.email = ["paul@annesley.cc"]
11
+ s.homepage = "http://rubygems.org/gems/devise-login-cookie"
12
+ s.summary = %q{Devise extension which sets a login cookie, for easier sharing of login between applications}
13
+ s.description = %q{Devise sets a "remember_token" cookie for Remember Me logins, but not for standard logins. This extension sets a separate cookie on login, which makes sharing login state between same-domain web applications easier.}
14
+
15
+ s.rubyforge_project = "devise-login-cookie"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_runtime_dependency("devise", ["~> 1.1.0"])
23
+
24
+ end
@@ -0,0 +1,26 @@
1
+ module DeviseLoginCookie
2
+
3
+ def success!(resource)
4
+ super
5
+ if succeeded?
6
+ cookies.signed["login_#{scope}_token"] = cookie_values(resource)
7
+ end
8
+ end
9
+
10
+ #########
11
+ protected
12
+
13
+ def cookie_values(resource)
14
+ value = [ resource.id, Time.now.to_i ]
15
+ options = Rails.configuration.session_options.slice(:path, :domain, :secure)
16
+ options.merge! :value => value
17
+ options
18
+ end
19
+
20
+ def succeeded?
21
+ @result == :success
22
+ end
23
+
24
+ end
25
+
26
+ Devise::Strategies::Authenticatable.send :include, DeviseLoginCookie
@@ -0,0 +1,3 @@
1
+ module DeviseLoginCookie
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devise-login-cookie
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Paul Annesley
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-04 00:00:00 +11:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: devise
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 1
31
+ - 0
32
+ version: 1.1.0
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Devise sets a "remember_token" cookie for Remember Me logins, but not for standard logins. This extension sets a separate cookie on login, which makes sharing login state between same-domain web applications easier.
36
+ email:
37
+ - paul@annesley.cc
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - README.md
48
+ - Rakefile
49
+ - devise-login-cookie.gemspec
50
+ - lib/devise-login-cookie.rb
51
+ - lib/devise-login-cookie/version.rb
52
+ has_rdoc: true
53
+ homepage: http://rubygems.org/gems/devise-login-cookie
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options: []
58
+
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ requirements: []
78
+
79
+ rubyforge_project: devise-login-cookie
80
+ rubygems_version: 1.3.7
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Devise extension which sets a login cookie, for easier sharing of login between applications
84
+ test_files: []
85
+