ixtlan-user-management 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,7 @@ module Ixtlan
|
|
35
35
|
user = nil
|
36
36
|
@restserver.create( Authentication.new(:login => username_or_email, :password => password) ) do |json, req|
|
37
37
|
user = user_new( JSON.load( json ) ) unless json.strip == ''
|
38
|
+
#tell restserver to ignore response
|
38
39
|
nil
|
39
40
|
end
|
40
41
|
user
|
@@ -60,4 +61,4 @@ module Ixtlan
|
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
63
|
-
end
|
64
|
+
end
|
@@ -18,14 +18,34 @@
|
|
18
18
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
19
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
20
|
#
|
21
|
-
require 'ixtlan/user_management/session_plugin'
|
22
21
|
|
23
22
|
module Ixtlan
|
24
23
|
module UserManagement
|
25
24
|
|
26
25
|
class SessionCuba < CubaAPI
|
27
26
|
|
28
|
-
|
27
|
+
def self.authenticator
|
28
|
+
self[ :authenticator ] ||= Authenticator.new( self[ :rest ] )
|
29
|
+
end
|
30
|
+
|
31
|
+
def log( msg )
|
32
|
+
if self.respond_to? :audit
|
33
|
+
audit( msg, { :username => login } )
|
34
|
+
else
|
35
|
+
warn( "[#{login}] #{msg}" )
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def login_and_password
|
40
|
+
source = parse_request_body rescue nil
|
41
|
+
source = req if source.nil? || source.empty?
|
42
|
+
auth = source[ 'authentication' ] || source
|
43
|
+
[ auth[ 'login' ] || auth[ 'email' ], auth[ 'password' ] ]
|
44
|
+
end
|
45
|
+
|
46
|
+
def login
|
47
|
+
login_and_password[ 0 ]
|
48
|
+
end
|
29
49
|
|
30
50
|
define do
|
31
51
|
on post, :reset_password do
|
@@ -57,8 +77,8 @@ module Ixtlan
|
|
57
77
|
head 200
|
58
78
|
end
|
59
79
|
|
60
|
-
on delete
|
61
|
-
self.class.authenticator.logout( current_user )
|
80
|
+
on delete do
|
81
|
+
self.class.authenticator.logout( current_user ) if current_user
|
62
82
|
log "logout"
|
63
83
|
reset_current_user
|
64
84
|
head 200
|
@@ -66,4 +86,4 @@ module Ixtlan
|
|
66
86
|
end
|
67
87
|
end
|
68
88
|
end
|
69
|
-
end
|
89
|
+
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: ixtlan-user-management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
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-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -126,7 +126,6 @@ files:
|
|
126
126
|
- lib/ixtlan/user_management/group_model.rb
|
127
127
|
- lib/ixtlan/user_management/user_resource.rb
|
128
128
|
- lib/ixtlan/user_management/session_manager.rb
|
129
|
-
- lib/ixtlan/user_management/session_plugin.rb
|
130
129
|
- lib/ixtlan/user_management/application_resource.rb
|
131
130
|
- lib/ixtlan/user_management/domain_resource.rb
|
132
131
|
- lib/ixtlan/user_management/authentication_model.rb
|
@@ -1,51 +0,0 @@
|
|
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
|
-
auth = req[:authentication] || req
|
43
|
-
[ auth[:login] || auth[:email], auth[:password] ]
|
44
|
-
end
|
45
|
-
|
46
|
-
def login
|
47
|
-
login_and_password[ 0 ]
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|