ixtlan-user-management 0.1.2 → 0.1.3
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.
- data/Gemfile +3 -3
- data/lib/ixtlan/user_management/authenticator.rb +2 -1
- data/lib/ixtlan/user_management/session_cuba.rb +6 -6
- data/lib/ixtlan/user_management/session_model.rb +1 -1
- data/lib/ixtlan/user_management/session_plugin.rb +53 -0
- data/lib/ixtlan/user_management/user_resource.rb +1 -1
- metadata +44 -39
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
|
-
|
4
|
-
gem '
|
3
|
+
|
4
|
+
gem 'copyright-header', '~>1.0', :platform => :mri
|
@@ -34,7 +34,8 @@ module Ixtlan
|
|
34
34
|
|
35
35
|
def login( username_or_email, password )
|
36
36
|
user = nil
|
37
|
-
@restserver.create( Authentication.new(:login => username_or_email,
|
37
|
+
@restserver.create( Authentication.new( :login => username_or_email,
|
38
|
+
:password => password) ) do |json, req|
|
38
39
|
user = user_new( MultiJson.load( json ) ) unless json.strip == ''
|
39
40
|
#tell restserver to ignore response
|
40
41
|
nil
|
@@ -50,10 +50,10 @@ module Ixtlan
|
|
50
50
|
on post, :reset_password do
|
51
51
|
if msg = self.class.authenticator.reset_password( login_and_password[ 0 ] )
|
52
52
|
log msg
|
53
|
-
|
53
|
+
no_body :ok
|
54
54
|
else
|
55
55
|
log "user/email not found"
|
56
|
-
|
56
|
+
no_body :not_found
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -67,7 +67,7 @@ module Ixtlan
|
|
67
67
|
write self.class.sessions.create( user )
|
68
68
|
else
|
69
69
|
log "access denied"
|
70
|
-
head 403
|
70
|
+
head :forbidden # 403
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -89,19 +89,19 @@ module Ixtlan
|
|
89
89
|
|
90
90
|
on get, 'ping' do
|
91
91
|
self.class.authenticator.ping( current_user )
|
92
|
-
|
92
|
+
no_body :ok
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
96
|
on get, /(me|ping)/ do
|
97
|
-
|
97
|
+
no_body :unauthorized # 401
|
98
98
|
end
|
99
99
|
|
100
100
|
on delete do
|
101
101
|
self.class.authenticator.logout( current_user ) if current_user
|
102
102
|
log "logout"
|
103
103
|
reset_current_user
|
104
|
-
|
104
|
+
no_body :ok
|
105
105
|
end
|
106
106
|
|
107
107
|
end
|
@@ -29,7 +29,7 @@ module Ixtlan
|
|
29
29
|
attribute :permissions, Array[Object]
|
30
30
|
|
31
31
|
def to_s
|
32
|
-
"Session( #{user.name}<#{user.login}> groups[ #{user.groups.collect { |g| g.name }.join ',' } ]
|
32
|
+
"Session( #{user.name}<#{user.login}> groups:[ #{user.groups.collect { |g| g.name }.join ',' } ] idle_timeout:#{idle_session_timeout} )"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2013 Christian Meier
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in
|
6
|
+
# the Software without restriction, including without limitation the rights to
|
7
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
#
|
21
|
+
require 'ixtlan/user_management/authenticator'
|
22
|
+
|
23
|
+
module Ixtlan
|
24
|
+
module UserManagement
|
25
|
+
module SessionPlugin
|
26
|
+
|
27
|
+
module ClassMethods
|
28
|
+
def authenticator
|
29
|
+
self[ :authenticator ] ||= Authenticator.new( self[ :rest ] )
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def log( msg )
|
34
|
+
if self.respond_to? :audit
|
35
|
+
audit( msg, { :username => login } )
|
36
|
+
else
|
37
|
+
warn( "[#{login}] #{msg}" )
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def login_and_password
|
42
|
+
source = parse_request_body
|
43
|
+
source = req if source && source.empty?
|
44
|
+
auth = source[ 'authentication' ] || source
|
45
|
+
[ auth[ 'login' ] || auth[ 'email' ], auth[ 'password' ] ]
|
46
|
+
end
|
47
|
+
|
48
|
+
def login
|
49
|
+
login_and_password[ 0 ]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ixtlan-user-management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Christian Meier
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.6'
|
21
21
|
none: false
|
22
22
|
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
none: false
|
@@ -31,15 +31,15 @@ dependencies:
|
|
31
31
|
name: rake
|
32
32
|
version_requirements: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - ~>
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 10.
|
36
|
+
version: '10.1'
|
37
37
|
none: false
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 10.
|
42
|
+
version: '10.1'
|
43
43
|
none: false
|
44
44
|
prerelease: false
|
45
45
|
type: :development
|
@@ -47,15 +47,15 @@ dependencies:
|
|
47
47
|
name: minitest
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
|
-
- -
|
50
|
+
- - ~>
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: '5.0'
|
53
53
|
none: false
|
54
54
|
requirement: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ~>
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
58
|
+
version: '5.0'
|
59
59
|
none: false
|
60
60
|
prerelease: false
|
61
61
|
type: :development
|
@@ -92,34 +92,40 @@ dependencies:
|
|
92
92
|
prerelease: false
|
93
93
|
type: :development
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: json
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- -
|
98
|
+
- - ~>
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: '1.
|
100
|
+
version: '1.7'
|
101
101
|
none: false
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- -
|
104
|
+
- - ~>
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: '1.
|
106
|
+
version: '1.7'
|
107
107
|
none: false
|
108
108
|
prerelease: false
|
109
109
|
type: :development
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: cuba-api
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - '>='
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
116
|
+
version: 0.5.1
|
117
|
+
- - <
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 0.6.0
|
117
120
|
none: false
|
118
121
|
requirement: !ruby/object:Gem::Requirement
|
119
122
|
requirements:
|
120
|
-
- -
|
123
|
+
- - '>='
|
121
124
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
125
|
+
version: 0.5.1
|
126
|
+
- - <
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 0.6.0
|
123
129
|
none: false
|
124
130
|
prerelease: false
|
125
131
|
type: :development
|
@@ -130,24 +136,25 @@ executables: []
|
|
130
136
|
extensions: []
|
131
137
|
extra_rdoc_files: []
|
132
138
|
files:
|
133
|
-
- lib/ixtlan-user-management.rb
|
134
139
|
- lib/ixtlan_user_management.rb
|
140
|
+
- lib/ixtlan-user-management.rb
|
135
141
|
- lib/ixtlan/passwords.rb
|
136
142
|
- lib/ixtlan/user_management.rb
|
137
|
-
- lib/ixtlan/user_management/
|
138
|
-
- lib/ixtlan/user_management/
|
143
|
+
- lib/ixtlan/user_management/session_cuba.rb
|
144
|
+
- lib/ixtlan/user_management/session_model.rb
|
139
145
|
- lib/ixtlan/user_management/dummy_authentication.rb
|
140
|
-
- lib/ixtlan/user_management/
|
141
|
-
- lib/ixtlan/user_management/
|
142
|
-
- lib/ixtlan/user_management/
|
143
|
-
- lib/ixtlan/user_management/user_resource.rb
|
146
|
+
- lib/ixtlan/user_management/session_plugin.rb
|
147
|
+
- lib/ixtlan/user_management/authenticator.rb
|
148
|
+
- lib/ixtlan/user_management/user_serializer.rb
|
144
149
|
- lib/ixtlan/user_management/session_manager.rb
|
145
|
-
- lib/ixtlan/user_management/
|
146
|
-
- lib/ixtlan/user_management/domain_resource.rb
|
150
|
+
- lib/ixtlan/user_management/session_serializer.rb
|
147
151
|
- lib/ixtlan/user_management/authentication_model.rb
|
148
|
-
- lib/ixtlan/user_management/session_model.rb
|
149
152
|
- lib/ixtlan/user_management/application_model.rb
|
150
|
-
- lib/ixtlan/user_management/
|
153
|
+
- lib/ixtlan/user_management/group_model.rb
|
154
|
+
- lib/ixtlan/user_management/domain_resource.rb
|
155
|
+
- lib/ixtlan/user_management/user_model.rb
|
156
|
+
- lib/ixtlan/user_management/application_resource.rb
|
157
|
+
- lib/ixtlan/user_management/user_resource.rb
|
151
158
|
- MIT-LICENSE
|
152
159
|
- README.md
|
153
160
|
- Gemfile
|
@@ -160,17 +167,15 @@ require_paths:
|
|
160
167
|
- lib
|
161
168
|
required_ruby_version: !ruby/object:Gem::Requirement
|
162
169
|
requirements:
|
163
|
-
- -
|
170
|
+
- - '>='
|
164
171
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
166
|
-
MA==
|
172
|
+
version: '0'
|
167
173
|
none: false
|
168
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
175
|
requirements:
|
170
|
-
- -
|
176
|
+
- - '>='
|
171
177
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
173
|
-
MA==
|
178
|
+
version: '0'
|
174
179
|
none: false
|
175
180
|
requirements: []
|
176
181
|
rubyforge_project:
|