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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 144fd3aa795724338186ed98df2c13a9d683a81e
4
- data.tar.gz: 3836ac1ef8478fc5e5c093d65c9522ffc83c0b6d
3
+ metadata.gz: 222b2fae99f677f8c6e49f800206a5f8a45fbec1
4
+ data.tar.gz: 31d2b7202177464de1aecf215c1bd69ee5d68fc8
5
5
  SHA512:
6
- metadata.gz: 714b7d07ca43cc5fdd2749cc5eb7cfdbcafebb7a2f663b9da6844a8101f062fcda85933940a49945fb5b0b01cddb1cad3a67bc141c1a4559b23b4332c1dc4dd8
7
- data.tar.gz: ce4184f8fc54d285a6dc32c6f98d87afd3b2d372387cf639e5c64cba778cb72ddc8cca1ddede9c3c9a7e6e56a87e917eda93f06047020c090d0f6b1b1de3babd
6
+ metadata.gz: 5bb0e3743db1f565de9abd5e40c82381fea866fb961ea168be3bbbb2ae2c9e0842249a8bd1f57a25e95458d30320c7c0f90bd80c6f01d486297d9b762b3fbc50
7
+ data.tar.gz: 0d25bc1aefef64314c7f68fa9e0af3a00f166b2842c23db6349cc1135404e7621e2b238b22712659de30e7b696aa0e57857fc3f487ea16ce26c5c03ccf6b7751
@@ -1 +1 @@
1
- require 'omniauth/edumall'
1
+ require 'edumall'
@@ -1,2 +1,3 @@
1
1
  require 'omniauth/edumall/version'
2
+ require 'omniauth/edumall/user'
2
3
  require 'omniauth/strategies/edumall'
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Edumall
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  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
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: 2016-12-15 00:00:00.000000000 Z
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