Commit 5742ccce authored by Renato Figueiro Maia's avatar Renato Figueiro Maia
Browse files

[OPENBUS-2864] Erros de validadores de senha ou token resultam em ServiceFailure para o cliente

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/branches/02_00_00@168721 ae0415b3-e90b-0410-900d-d0be9363c56b
parent c8a0f23d
......@@ -7,6 +7,7 @@ local pairs = _G.pairs
local pcall = _G.pcall
local rawset = _G.rawset
local type = _G.type
local xpcall = _G.xpcall
local coroutine = require "coroutine"
local newthread = coroutine.create
......@@ -26,6 +27,9 @@ local schedule = cothread.schedule
local unschedule = cothread.unschedule
local waituntil = cothread.defer
local debug = require "debug"
local traceback = debug.traceback
local uuid = require "uuid"
local newid = uuid.new
......@@ -389,8 +393,16 @@ function AccessControl:loginByPassword(entity, pubkey, encrypted)
NO_RESOURCES{ completed = "COMPLETED_YES", minor = 0x42555000 }
end
for _, validator in ipairs(self.passwordValidators) do
local valid, errmsg = validator.validate(entity, decoded.data)
if valid then
local ok, valid, errmsg = xpcall(validator.validate, traceback, entity, decoded.data)
if not ok then
ServiceFailure{
message = msg.FailedPasswordValidation:tag{
entity = entity,
validator = validator.name,
errmsg = valid,
}
}
elseif valid then
local login = self.activeLogins:newLogin(entity, pubkey)
log:request(msg.LoginByPassword:tag{
login = login.id,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment