omniauth-applicaster 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +10 -0
- data/lib/applicaster/auth_helpers.rb +11 -4
- data/lib/omniauth-applicaster/version.rb +1 -1
- data/spec/lib/applicaster/auth_helpers_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d72901376c9698e3c3e8c5c411c051e616c3a71
|
4
|
+
data.tar.gz: e6bb8bb5e953da8d08ce56e16059f637922b0ada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c3d8a9f3829ff1c87623e042db0987156b8e3c39cd6aaed7179d6c11214e527b3819c10c3e3d7777bfaef1dcb8a4474b24f680a013a1de55a8485167c79b421
|
7
|
+
data.tar.gz: e6b3850aa5f59dca554a2c973e3904d840e71abed41c6b478e2c574791bf8be64cc968dc40342454efb882f4b2d0cf05c9b21c2f9bc1adf73211b542a488150e
|
data/Rakefile
CHANGED
@@ -15,14 +15,21 @@ module Applicaster
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
def current_access_token
|
19
|
+
session[:omniauth_credentials][:token] if session[:omniauth_credentials]
|
20
|
+
end
|
21
|
+
|
18
22
|
protected
|
19
23
|
|
24
|
+
def clear_omniauth_credentials
|
25
|
+
session.delete(:omniauth_credentials)
|
26
|
+
end
|
27
|
+
|
20
28
|
def user_from_session
|
21
|
-
return nil unless
|
29
|
+
return nil unless current_access_token
|
22
30
|
|
23
|
-
|
24
|
-
|
25
|
-
session.delete(:omniauth_credentials) unless user
|
31
|
+
Applicaster::Accounts.user_from_token(current_access_token).tap do |user|
|
32
|
+
clear_omniauth_credentials unless user
|
26
33
|
end
|
27
34
|
end
|
28
35
|
end
|
@@ -92,6 +92,24 @@ RSpec.describe Applicaster::AuthHelpers do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
describe "#current_access_token" do
|
96
|
+
it "returns access token" do
|
97
|
+
expect(controller.current_access_token).to eq(
|
98
|
+
session[:omniauth_credentials][:token]
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
context "when session has no omniauth_credentials" do
|
103
|
+
it "returns nil" do
|
104
|
+
expect(controller.current_access_token).to be nil
|
105
|
+
end
|
106
|
+
|
107
|
+
def session
|
108
|
+
{}
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
95
113
|
def session
|
96
114
|
{
|
97
115
|
omniauth_credentials: {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-applicaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neer Friedman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|