4 /* Return true to allow access; false otherwise */
5 function json_authenticate(serviceComponents, method, scriptTransportId, error)
7 // Don't allow any access via ScriptTransport, for now. There are serious
8 // potential security exploits that will need to be protected against when
9 // we do want to allow use of ScriptTransport. -- djl
10 if (scriptTransportId != jsonrpc.Constant.ScriptTransport.NotInUse)
12 error.setError(jsonrpc.Constant.ServerError.PermissionDenied,
17 // Does the requested method require authentication?
18 if (! _authentication_required(serviceComponents, method))
24 // Did our session expire?
25 if (request['SESSION_EXPIRED'] == "True")
28 error.setError(jsonrpc.Constant.ServerError.SessionExpired,
30 error.setInfo(getDomainList());
34 // Are we authenticated?
35 if (! session.AUTHENTICATED)
38 error.setError(jsonrpc.Constant.ServerError.NotLoggedIn,
40 error.setInfo(getDomainList());
49 * Return true if authentication is required for the specified method;
52 function _authentication_required(serviceComponents, method)
54 var m = join(".", serviceComponents) + "." + method;
56 // See if this method requires authentication
57 if (m == "samba.system.login" ||
58 m == "samba.system.logout")
64 // Anything not listed above requires authentication