shared_key no longer required to validate users.
parent
18e06134fd
commit
55573dd330
11
src/authd.cr
11
src/authd.cr
|
@ -223,14 +223,10 @@ class AuthD::Request
|
||||||
end
|
end
|
||||||
|
|
||||||
class ValidateUser < Request
|
class ValidateUser < Request
|
||||||
# Only clients that have the right shared key will be allowed
|
|
||||||
# to validate users.
|
|
||||||
property shared_key : String
|
|
||||||
|
|
||||||
property login : String
|
property login : String
|
||||||
property activation_key : String
|
property activation_key : String
|
||||||
|
|
||||||
initialize :shared_key, :login, :activation_key
|
initialize :login, :activation_key
|
||||||
end
|
end
|
||||||
|
|
||||||
class GetUser < Request
|
class GetUser < Request
|
||||||
|
@ -452,10 +448,7 @@ module AuthD
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_user(login : String, activation_key : String) : ::AuthD::User::Public | Exception
|
def validate_user(login : String, activation_key : String) : ::AuthD::User::Public | Exception
|
||||||
|
send Request::ValidateUser.new login, activation_key
|
||||||
pp! login
|
|
||||||
pp! activation_key
|
|
||||||
send Request::ValidateUser.new @key, login, activation_key
|
|
||||||
|
|
||||||
response = Response.from_ipc read
|
response = Response.from_ipc read
|
||||||
|
|
||||||
|
|
|
@ -106,10 +106,6 @@ class AuthD::Service
|
||||||
|
|
||||||
Response::UserAdded.new user.to_public
|
Response::UserAdded.new user.to_public
|
||||||
when Request::ValidateUser
|
when Request::ValidateUser
|
||||||
if request.shared_key != @jwt_key
|
|
||||||
return Response::Error.new "invalid authentication key"
|
|
||||||
end
|
|
||||||
|
|
||||||
user = @users_per_login.get? request.login
|
user = @users_per_login.get? request.login
|
||||||
|
|
||||||
if user.nil?
|
if user.nil?
|
||||||
|
@ -124,7 +120,7 @@ class AuthD::Service
|
||||||
if user.contact.activation_key == request.activation_key
|
if user.contact.activation_key == request.activation_key
|
||||||
user.contact.activation_key = nil
|
user.contact.activation_key = nil
|
||||||
else
|
else
|
||||||
return Response::Error.new "Wrong activation key"
|
return Response::Error.new "wrong activation key"
|
||||||
end
|
end
|
||||||
|
|
||||||
@users_per_uid.update user.uid.to_s, user
|
@users_per_uid.update user.uid.to_s, user
|
||||||
|
@ -392,7 +388,6 @@ class AuthD::Service
|
||||||
|
|
||||||
users = @users.to_a
|
users = @users.to_a
|
||||||
users.each do |u|
|
users.each do |u|
|
||||||
# pp! u
|
|
||||||
if pattern =~ u.login
|
if pattern =~ u.login
|
||||||
puts "#{u.login} matches #{pattern}"
|
puts "#{u.login} matches #{pattern}"
|
||||||
matching_users << u.to_public
|
matching_users << u.to_public
|
||||||
|
|
Loading…
Reference in New Issue