axis-c engine: Support Basic Authentication of apache2, thus can get 
username/password pair info directly
---------------------------------------------------------------------------------------------------------

         Key: AXISCPP-971
         URL: http://issues.apache.org/jira/browse/AXISCPP-971
     Project: Axis-C++
        Type: Improvement

  Components: Server - Apache module, Server - Engine  
    Versions:  1.6 Beta    
 Environment: Platform:
        Linux fedora 3.0
Axis version:
        Server-side Axis C++ 1.6Beta
XML Parser Lib:
xersesc 2.6
WSDL2ws tool by using axis java 1.3
Client-side version Axis java 1.3
Http Server Version:
Apache 2.0.53
Tomcat 2.0.58
    Reporter: Michael Xiong


I'm  developing a web service server module by axis-c  on fc3/apache2 platform.
This server module need to be accessed through basic authentication of 
apache2(as http standard), and it internally need to login again to the 
lower-level legacy privileged system.
But I found that  though axis-c engine can access username/password pair info 
from apache2(which checked by mod_auth module first), my server module which 
interacting with  axis-c engine can not get username/password directly, because 
axis-c engine discarded the username/password info during the communication 
between apache2 and  my server module.
Thus my server module can not get username/password pair from http basic 
authentication, which will cause my server module very difficult to login to 
the lower-level legacy privileged system.

I've investigated both 1.5final version and 1.6beta version, they all have the 
same problem.
Because the axis-c engine acting as a bridge between apache2 and my server 
module, so I think it's necessary to modify axis-c engine to resolve this 
problem.

So I'd like to give some improvement to the axis-c engine code of 1.6beta 
version, so that any server module can simply get the username/password pair 
info from IMessageData interface.
The below is my modification for this improvement, please check.(I've verified 
my code change on my platform, it works well)
Totally 4 source file need to be modified: 
1. include/axis/IMessageData.hpp
2. src/common/MessageData.h
3. src/engine/server/ServerAxisEngine.cpp
4. src/server/apache2/Apache2Transport.cpp

For detail, pleae refer to below:
------------------------------------------------------------------------------------------------------------
IMessageData.hpp: add two public interface:
//<mxiong debug 2006/5/25
public:
        virtual void setPassword(string& m_sPassword) = 0;
        virtual string& getPassword() = 0;
//>mxiong debug 2006/5/25

----------------------------------------------------------------------------------------------------

MessageData.h; implement the added interface which used to access password info:
//<mxiong debug 2006/5/25
public:
    void setPassword(string& sPassword) { m_sPassword = sPassword; }
    string& getPassword() { return m_sPassword; }
protected:
    string m_sPassword;
//>mxiong debug 2006/5/25
------------------------------------------------------------------------------------------------------

ServerAxisEngine.cpp: in ServerAxisEngine::process (SOAPTransport * pStream), 
add some code as the below:
        do
        {
            /* populate MessageData with transport information */
            m_pMsgData->m_Protocol = pStream->getProtocol ();
//<mxiong debug 2006/5/25
        string username;
        if (NULL!=pStream->getTransportProperty("username"))
        {
                username = (string)pStream->getTransportProperty("username");
        }
        else
        {
                username = "";
        }
        m_pMsgData->setUserName(username);
        
        string password;
        if (NULL!=pStream->getTransportProperty("password"))
        {
                password = (string)pStream->getTransportProperty("password");
        }
        else
        {
                password = "";
        }
        m_pMsgData->setPassword(password);
//>mxiong debug 2006/5/25
            if (AXIS_SUCCESS != m_pDZ->setInputStream (pStream))

--------------------------------------------------------------------------------------------------------------
Apache2Transport.cpp: in const char* 
Apache2Transport::getTransportProperty(const char* pcKey, bool response), add 
the below code at the beginning:
//<mxiong debug 2006/5/25
    static const char* USER_NAME = "username";
    static const char* PASSWORD = "password";
    if (!strcmp(USER_NAME, pcKey)) {
        return ((request_rec*)m_pContext)->user;
    } else if (!strcmp(PASSWORD, pcKey)) {
        const char* password = "";
        ap_get_basic_auth_pw((request_rec*)m_pContext, &password);
        return password;
    }   
//>mxiong debug 2006/5/25
-------------------------------------------------------------------------------------------------------------------


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to