axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdinap...@apache.org
Subject cvs commit: ws-axis/c/src/engine/client Stub.cpp
Date Fri, 22 Jul 2005 05:32:56 GMT
cdinapala    2005/07/21 22:32:56

  Modified:    c/include/axis/client Stub.hpp
               c/src/engine/client Stub.cpp
  Log:
  Include the proxy authentication support in client stub.
  
  -Chinthana
  
  Revision  Changes    Path
  1.25      +35 -0     ws-axis/c/include/axis/client/Stub.hpp
  
  Index: Stub.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/Stub.hpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Stub.hpp	21 Jun 2005 14:14:13 -0000	1.24
  +++ Stub.hpp	22 Jul 2005 05:32:56 -0000	1.25
  @@ -605,6 +605,26 @@
       const char* getPassword();
   
     /**
  +    * Sets the username to be used for Proxy authentication
  +    */
  +    void setProxyUsername(const char* pcProxyUsername);
  +
  +  /**
  +    * Sets the password to be used for Proxy authentication
  +    */
  +    void setProxyPassword(const char* pcProxyPassword);
  +
  +  /**
  +    * Gets the username used for Proxy authentication
  +    */
  +    const char* getProxyUsername();
  +
  +  /**
  +    * Gets the password used for Proxy authentication
  +    */
  +    const char* getProxyPassword();
  +
  +  /**
       * Call object of the Stub. This is the point of access to the internals
       * of the Axis engine.
       */
  @@ -637,6 +657,12 @@
       * Set Authorization header for basic authentication
       */
       void setAuthorizationHeader();
  +  
  +  /**
  +    * Set Authorization header for Proxy authentication
  +    */
  +    void setProxyAuthorizationHeader();
  +
   
       Call *m_pCall;
   
  @@ -671,6 +697,15 @@
       * Password
       */
      char* m_pcPassword;
  +  /**
  +    * proxy Username
  +    */
  +   char* m_proxyUsername;
  +
  +  /**
  +    * proxy Password
  +    */
  +   char* m_proxyPassword;
   };
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.49      +79 -1     ws-axis/c/src/engine/client/Stub.cpp
  
  Index: Stub.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/client/Stub.cpp,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- Stub.cpp	21 Jun 2005 14:14:13 -0000	1.48
  +++ Stub.cpp	22 Jul 2005 05:32:56 -0000	1.49
  @@ -29,7 +29,9 @@
   AXIS_CPP_NAMESPACE_USE
       Stub::Stub (const char *pcEndPointUri, AXIS_PROTOCOL_TYPE eProtocol):
   m_pcUsername (NULL),
  -m_pcPassword (NULL)
  +m_pcPassword (NULL),
  +m_proxyUsername (NULL),
  +m_proxyPassword (NULL)
   {
       m_pCall = new Call ();
       m_pCall->setProtocol (eProtocol);
  @@ -385,6 +387,27 @@
   }
   
   void
  +Stub::setProxyUsername (const char *pcProxyUsername)
  +{
  +    if (m_proxyUsername)
  +    {
  +	delete[]m_proxyUsername;
  +	m_proxyUsername = NULL;
  +    }
  +
  +    if (!pcProxyUsername)
  +	return;
  +
  +    m_proxyUsername = new char[strlen (pcProxyUsername) + 1];
  +    strcpy (m_proxyUsername, pcProxyUsername);
  +
  +    if (m_proxyPassword)
  +    {
  +	setProxyAuthorizationHeader ();
  +    }
  +}
  +
  +void
   Stub::setPassword (const char *pcPassword)
   {
       if (m_pcPassword)
  @@ -405,6 +428,27 @@
       }
   }
   
  +void
  +Stub::setProxyPassword (const char *pcProxyPassword)
  +{
  +    if (m_proxyPassword)
  +    {
  +	delete[]m_proxyPassword;
  +	m_proxyPassword = NULL;
  +    }
  +
  +    if (!pcProxyPassword)
  +	return;
  +
  +    m_proxyPassword = new char[strlen (pcProxyPassword) + 1];
  +    strcpy (m_proxyPassword, pcProxyPassword);
  +
  +    if (m_proxyUsername)
  +    {
  +	setProxyAuthorizationHeader ();
  +    }
  +}
  +
   const char *
   Stub::getUsername ()
   {
  @@ -412,11 +456,23 @@
   }
   
   const char *
  +Stub::getProxyUsername ()
  +{
  +    return m_proxyUsername;
  +}
  +
  +const char *
   Stub::getPassword ()
   {
       return m_pcPassword;
   }
   
  +const char *
  +Stub::getProxyPassword ()
  +{
  +    return m_proxyPassword;
  +}
  +
   void
   Stub::setAuthorizationHeader ()
   {
  @@ -444,6 +500,28 @@
       delete[]base64Value;
   }
   
  +void 
  +Stub::setProxyAuthorizationHeader ()
  +{
  +    char* cpUsernamePassword = new char[strlen( m_proxyUsername) + strlen( m_proxyPassword
) + 2];
  +    strcpy( cpUsernamePassword, m_proxyUsername );
  +    strcat( cpUsernamePassword, ":" );
  +    strcat( cpUsernamePassword, m_proxyPassword );
  +    int len = apr_base64_encode_len (strlen(cpUsernamePassword));
  +     
  +	AxisChar* base64Value = new AxisChar[len + 1];
  +    len = apr_base64_encode_binary ( base64Value, (const unsigned char*)cpUsernamePassword,
strlen
  +                                                                                   (cpUsernamePassword));
  +  
  +	std::string strValue = "Basic ";
  +    strValue += base64Value;
  +  
  +	this->setTransportProperty( "Proxy-Authorization", strValue.c_str());
  +    delete [] cpUsernamePassword;
  +    delete [] base64Value;
  +
  +}
  +
   ISoapAttachment* Stub::createSoapAttachment()
   {
   	return m_pCall->createSoapAttachment();
  
  
  

Mime
View raw message