43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/ixtlan/remote/access_controller.rb', line 43
def remote_permission
@_remote_permission ||=
begin
perm = nil
token = x_service_token
raise "ip #{request.remote_ip} sent no token" unless token
permission_model.all.each do |rp|
perm = rp if rp.authentication_token && constant_time_compare(rp.authentication_token, token)
end
raise "ip #{request.remote_ip} wrong authentication" unless perm
raise "ip #{request.remote_ip} not allowed" if (!perm.allowed_ip.blank? && request.remote_ip != perm.allowed_ip)
perm
end
end
|