shared_key no longer required to validate users.

This commit is contained in:
Luka Vandervelden 2020-04-03 16:42:45 +02:00
parent 18e06134fd
commit 55573dd330
2 changed files with 3 additions and 15 deletions

View File

@ -223,14 +223,10 @@ class AuthD::Request
end
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 activation_key : String
initialize :shared_key, :login, :activation_key
initialize :login, :activation_key
end
class GetUser < Request
@ -452,10 +448,7 @@ module AuthD
end
def validate_user(login : String, activation_key : String) : ::AuthD::User::Public | Exception
pp! login
pp! activation_key
send Request::ValidateUser.new @key, login, activation_key
send Request::ValidateUser.new login, activation_key
response = Response.from_ipc read

View File

@ -106,10 +106,6 @@ class AuthD::Service
Response::UserAdded.new user.to_public
when Request::ValidateUser
if request.shared_key != @jwt_key
return Response::Error.new "invalid authentication key"
end
user = @users_per_login.get? request.login
if user.nil?
@ -124,7 +120,7 @@ class AuthD::Service
if user.contact.activation_key == request.activation_key
user.contact.activation_key = nil
else
return Response::Error.new "Wrong activation key"
return Response::Error.new "wrong activation key"
end
@users_per_uid.update user.uid.to_s, user
@ -392,7 +388,6 @@ class AuthD::Service
users = @users.to_a
users.each do |u|
# pp! u
if pattern =~ u.login
puts "#{u.login} matches #{pattern}"
matching_users << u.to_public