omniauth-edumall 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth-edumall.rb +1 -1
- data/lib/omniauth/edumall.rb +1 -0
- data/lib/omniauth/edumall/user.rb +36 -0
- data/lib/omniauth/edumall/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 222b2fae99f677f8c6e49f800206a5f8a45fbec1
|
4
|
+
data.tar.gz: 31d2b7202177464de1aecf215c1bd69ee5d68fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bb0e3743db1f565de9abd5e40c82381fea866fb961ea168be3bbbb2ae2c9e0842249a8bd1f57a25e95458d30320c7c0f90bd80c6f01d486297d9b762b3fbc50
|
7
|
+
data.tar.gz: 0d25bc1aefef64314c7f68fa9e0af3a00f166b2842c23db6349cc1135404e7621e2b238b22712659de30e7b696aa0e57857fc3f487ea16ce26c5c03ccf6b7751
|
data/lib/omniauth-edumall.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require '
|
1
|
+
require 'edumall'
|
data/lib/omniauth/edumall.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Omniauth
|
2
|
+
module Edumall
|
3
|
+
module User
|
4
|
+
extend self
|
5
|
+
EDUMALL_SSO_URL = 'http://edumall.local.vn:3000'
|
6
|
+
def user_logout?(cookies)
|
7
|
+
edumall_access_token = cookies[:edumall_access_token]
|
8
|
+
return edumall_access_token.blank?
|
9
|
+
end
|
10
|
+
|
11
|
+
def user_logged(cookies)
|
12
|
+
edumall_access_token = cookies[:edumall_access_token]
|
13
|
+
RestClient.get("#{EDUMALL_SSO_URL}/auth/sso/user.json?oauth_token=#{cookies[:edumall_access_token]}") { |response, request, result, &block|
|
14
|
+
case response.code
|
15
|
+
when 200
|
16
|
+
user_response = JSON.parse(response.body)
|
17
|
+
return user_response
|
18
|
+
else
|
19
|
+
return {}
|
20
|
+
end
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def logout
|
25
|
+
RestClient.post("#{EDUMALL_SSO_URL}/auth/signout") { |response, request, result, &block|
|
26
|
+
case response.code
|
27
|
+
when 200
|
28
|
+
return true
|
29
|
+
else
|
30
|
+
return false
|
31
|
+
end
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-edumall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hoptq
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- bin/setup
|
80
80
|
- lib/omniauth-edumall.rb
|
81
81
|
- lib/omniauth/edumall.rb
|
82
|
+
- lib/omniauth/edumall/user.rb
|
82
83
|
- lib/omniauth/edumall/version.rb
|
83
84
|
- lib/omniauth/strategies/edumall.rb
|
84
85
|
- test/omniauth/edumall_test.rb
|