Here is the solution:
If anonymous access to XML DB repository data via HTTP is not required, then you do not have to perform this step.
If anonymous access to XML DB repository data via HTTP is required, then you must provide correct configuration information, as described in this section. The administrator must carefully consider whether anonymous access is to be allowed, given the inherent security risks.
If you wish to have anonymous access to XML DB repository data via HTTP, you must change the XML DB configuration file (located at /xdbconfig.xml in the repository) by adding an additional element "allow-repository-anonymous-access" and set this new element to true, in addition to unlocking the ANONYMOUS user account.
connect sys/password@tns_alias AS SYSDBA
-- enable anonymous access to XDB repository
SET SERVEROUTPUT ON
DECLARE
l_cfgxml XMLTYPE;
l_value VARCHAR2(5) := 'true'; -- (true/false)
BEGIN
l_cfgxml := DBMS_XDB.cfg_get();
IF l_cfgxml.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access') = 0 THEN
-- Add missing element.
SELECT insertChildXML
(
l_cfgxml,
'/xdbconfig/sysconfig/protocolconfig/httpconfig',
'allow-repository-anonymous-access',
XMLType('
l_value ||
'
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
)
INTO l_cfgxml
FROM dual;
DBMS_OUTPUT.put_line('Element inserted.');
ELSE
-- Update existing element.
SELECT updateXML
(
DBMS_XDB.cfg_get(),
'/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access/text()',
l_value,
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
)
INTO l_cfgxml
FROM dual;
DBMS_OUTPUT.put_line('Element updated.');
END IF;
DBMS_XDB.cfg_update(l_cfgxml);
DBMS_XDB.cfg_refresh;
END;
/
Once the "
connect sys/password@tns_alias AS SYSDBA
ALTER USER anonymous ACCOUNT UNLOCK;
Removing anonymous access to the XML DB repository, not web services, can be accomplished by locking the anonymous database account, or setting the "
If you need to remove the "
connect sys/password@tns_alias AS SYSDBA
SET SERVEROUTPUT ON
DECLARE
l_cfgxml XMLTYPE;
BEGIN
l_cfgxml := DBMS_XDB.cfg_get();
IF l_cfgxml.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access') != 0 THEN
SELECT deleteXML
(
l_cfgxml,
'/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access',
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
)
INTO l_cfgxml
FROM dual;
DBMS_XDB.cfg_update(l_cfgxml);
DBMS_XDB.cfg_refresh;
DBMS_OUTPUT.put_line('Element deleted.');
END IF;
END;
/
No comments:
Post a Comment