wizdog 0.2.0 → 0.2.1
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 +4 -4
- data/lib/wizdog/authc/filter.rb +1 -1
- data/lib/wizdog/authc/security_context.rb +21 -29
- data/lib/wizdog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9e2e4e8884ccdd801328f1a8d14618491587495
|
4
|
+
data.tar.gz: 9c5fc3b1c4e7d3237ee029dac1ea1325371a1dc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36532dc5c62c5596207c70d8ce71689f1aa1ff74a026be27f1c1a0739a98d335f8dc83bafa968ae6acf11c99f31bbc577de1d1322718905b444b916effdb8e15
|
7
|
+
data.tar.gz: c009edab7db4301de04c468f8715650c803ac30d7e677426bde41c190de2822bd83342c73e86d7974e70449b95fa5fd1c70848233a18710ccedaf9a3e3469d77
|
data/lib/wizdog/authc/filter.rb
CHANGED
@@ -26,7 +26,7 @@ module WizAuthc
|
|
26
26
|
# private
|
27
27
|
# def activate_wiz_auth
|
28
28
|
# p self.session.to_s
|
29
|
-
# WizAuthc::SecurityContext.init(self, Util::Account
|
29
|
+
# WizAuthc::SecurityContext.init(self, Util::Account)
|
30
30
|
# @current = WizAuthc::SecurityContext.current
|
31
31
|
# end
|
32
32
|
end
|
@@ -5,6 +5,24 @@ module WizAuthc
|
|
5
5
|
class SecurityContext
|
6
6
|
# @@ip = "0.0.0.0"
|
7
7
|
# @@contexts = {}
|
8
|
+
attr_accessor :principal, :authenticated, :session
|
9
|
+
|
10
|
+
def initialize(principal, authenticated = nil, session = nil, ip = nil)
|
11
|
+
@principal = principal || nil
|
12
|
+
@authenticated = authenticated || false
|
13
|
+
@session = session
|
14
|
+
@ip = ip || "0.0.0.0"
|
15
|
+
@actived = false
|
16
|
+
end
|
17
|
+
|
18
|
+
def authenticated?
|
19
|
+
@authenticated
|
20
|
+
end
|
21
|
+
|
22
|
+
def user
|
23
|
+
@principal[:type].constantize.find(@principal[:identity])
|
24
|
+
end
|
25
|
+
|
8
26
|
class << self
|
9
27
|
def env
|
10
28
|
Thread.current[:security_env_key]
|
@@ -20,7 +38,7 @@ module WizAuthc
|
|
20
38
|
|
21
39
|
def current=(value)
|
22
40
|
# Thread.current[:security_context_key] = value
|
23
|
-
|
41
|
+
Thread.current[:security_contexts_key] = value
|
24
42
|
end
|
25
43
|
|
26
44
|
def session
|
@@ -35,17 +53,11 @@ module WizAuthc
|
|
35
53
|
Thread.current[:security_contexts_key]
|
36
54
|
end
|
37
55
|
|
38
|
-
def init(env,
|
56
|
+
def init(env, klass)
|
39
57
|
self.env = env
|
40
|
-
self.current =
|
58
|
+
self.current = klass.new(self.session)
|
41
59
|
end
|
42
60
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
#--------------------------
|
48
|
-
|
49
61
|
def authenticate(realm, token)
|
50
62
|
authc_info = realm.authenticate(token)
|
51
63
|
# ctx = self.current
|
@@ -56,26 +68,6 @@ module WizAuthc
|
|
56
68
|
# env.session[:security_contexts_key] = ctx
|
57
69
|
self.current = ctx
|
58
70
|
end
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
attr_accessor :principal, :authenticated, :session
|
64
|
-
|
65
|
-
def initialize(principal, authenticated = nil, session = nil, ip = nil)
|
66
|
-
@principal = principal || nil
|
67
|
-
@authenticated = authenticated || false
|
68
|
-
@session = session
|
69
|
-
@ip = ip || "0.0.0.0"
|
70
|
-
@actived = false
|
71
|
-
end
|
72
|
-
|
73
|
-
def authenticated?
|
74
|
-
@authenticated
|
75
|
-
end
|
76
|
-
|
77
|
-
def user
|
78
|
-
@principal[:type].constantize.find(@principal[:identity])
|
79
71
|
end
|
80
72
|
end
|
81
73
|
end
|
data/lib/wizdog/version.rb
CHANGED