Commit aee57074 authored by Renato Figueiro Maia's avatar Renato Figueiro Maia

[OPENBUS-1841] Renomear operações relacionadas ao "login by single sign-on"...

[OPENBUS-1841] Renomear operações relacionadas ao "login by single sign-on" para algo como "login by shared authentication"



git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/sdk/lua/branches/openbus_v2_proto@130434 ae0415b3-e90b-0410-900d-d0be9363c56b
parent a4eb0638
......@@ -12,8 +12,8 @@ local conn2 = openbus.connect("localhost", 2089, orb2)
conn1:loginByPassword("demo", "demo")
-- login to the bus using single sign-on
local logger, secret = conn1:startSingleSignOn()
conn2:loginBySingleSignOn(logger, secret)
local logger, secret = conn1:startSharedAuth()
conn2:loginBySharedAuth(logger, secret)
-- find the offered service
for _, conn in ipairs{conn1, conn2} do
......
......@@ -405,9 +405,9 @@ function Connection:loginByCertificate(entity, privatekey)
})
end
function Connection:startSingleSignOn()
function Connection:startSharedAuth()
local attempt, challenge = callWithin(self, self.AccessControl,
"startLoginBySingleSignOn")
"startLoginBySharedAuth")
local secret, errmsg = self.prvkey:decrypt(challenge)
if secret == nil then
attempt:cancel()
......@@ -416,11 +416,11 @@ function Connection:startSingleSignOn()
return attempt, secret
end
function Connection:cancelSingleSignOn(attempt)
function Connection:cancelSharedAuth(attempt)
attempt:cancel()
end
function Connection:loginBySingleSignOn(attempt, secret)
function Connection:loginBySharedAuth(attempt, secret)
if self.login ~= nil then error(msg.AlreadyLoggedIn) end
local access = self.AccessControl
local busid = access:_get_busid()
......@@ -440,7 +440,7 @@ function Connection:loginBySingleSignOn(attempt, secret)
self.busid = busid
self.buskey = buskey
newRenewer(self, lease)
log:request(msg.LoginBySingleSignOn:tag{
log:request(msg.LoginBySharedAuth:tag{
bus = busid,
login = login.id,
entity = login.entity,
......@@ -597,8 +597,8 @@ do
[Connection] = {
"loginByPassword",
"loginByCertificate",
"loginBySingleSignOn",
"cancelSingleSignOn",
"loginBySharedAuth",
"cancelSharedAuth",
},
[ConnectionManager] = {
"createConnection",
......
......@@ -71,7 +71,7 @@ end
local loginways = {
loginByPassword = function() return user, password end,
loginByCertificate = function() return system, syskey end,
loginBySingleSignOn = function()
loginBySharedAuth = function()
return { -- dummy login process object
login = function()
return {
......@@ -103,8 +103,8 @@ local function assertlogged(conn)
assert(conn.login.id == loginid)
assert(conn.busid == busid)
end
-- check the failure of 'startSingleSignOn'
conn:cancelSingleSignOn(conn:startSingleSignOn())
-- check the failure of 'startSharedAuth'
conn:cancelSharedAuth(conn:startSharedAuth())
-- check the login is valid to perform calls
callwithin(conn, offers.findServices, offers, {})
return conn
......@@ -120,8 +120,8 @@ local function assertlogoff(conn)
assert(conn.busid == nil)
-- check the attempt to logoff again
assert(conn:logout() == false)
-- check the failure of 'startSingleSignOn'
local ex = catcherr(conn.startSingleSignOn, conn)
-- check the failure of 'startSharedAuth'
local ex = catcherr(conn.startSharedAuth, conn)
assert(ex._repid == sysex.NO_PERMISSION)
assert(ex.completed == "COMPLETED_NO")
assert(ex.minor == idl.const.services.access_control.NoLoginCode)
......@@ -269,34 +269,34 @@ for _, connOp in ipairs({"DefaultConnection", "Requester"}) do
for otherIdx, other in ipairs(conns) do
if other.login == nil then
log:TEST(true, "Connection::loginBySingleSignOn (from=Connection::",op,")")
log:TEST(true, "Connection::loginBySharedAuth (from=Connection::",op,")")
do log:TEST "login with wrong secret"
local attempt = conn:startSingleSignOn()
local ex = catcherr(other.loginBySingleSignOn, other, attempt, "WrongSecret")
local attempt = conn:startSharedAuth()
local ex = catcherr(other.loginBySharedAuth, other, attempt, "WrongSecret")
assert(ex._repid == idl.types.services.access_control.AccessDenied)
assertlogoff(other)
assertlogged(conn)
end
do log:TEST "login with canceled attempt"
local attempt, secret = conn:startSingleSignOn()
conn:cancelSingleSignOn(attempt)
local ex = catcherr(other.loginBySingleSignOn, other, attempt, secret)
local attempt, secret = conn:startSharedAuth()
conn:cancelSharedAuth(attempt)
local ex = catcherr(other.loginBySharedAuth, other, attempt, secret)
assert(ex._repid == sysex.OBJECT_NOT_EXIST)
assertlogoff(other)
assertlogged(conn)
end
do log:TEST "login with expired attempt"
local attempt, secret = conn:startSingleSignOn()
local attempt, secret = conn:startSharedAuth()
sleep(2*leasetime)
local ex = catcherr(other.loginBySingleSignOn, other, attempt, secret)
local ex = catcherr(other.loginBySharedAuth, other, attempt, secret)
assert(ex._repid == sysex.OBJECT_NOT_EXIST)
assertlogoff(other)
assertlogged(conn)
end
do
testlogin(other, "loginBySingleSignOn", function()
return conn:startSingleSignOn()
testlogin(other, "loginBySharedAuth", function()
return conn:startSharedAuth()
end)
assertlogged(conn)
end
......
Markdown is supported
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