You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2007/02/12 05:51:51 UTC

svn commit: r506281 - in /webservices/axis2/scratch/c/security-policy/c/rampart: include/ samples/client/enc_echo/data/ samples/server/sec_echo/ src/handlers/ src/secpolicy/model/ src/secpolicy/test-resources/ src/util/

Author: kaushalye
Date: Sun Feb 11 20:51:49 2007
New Revision: 506281

URL: http://svn.apache.org/viewvc?view=rev&rev=506281
Log:
Applying the patch in AXIS2C-488 jira.

Added:
    webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_engine.h   (with props)
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_engine.c
Modified:
    webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_constants.h
    webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h
    webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_handler_util.h
    webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h
    webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h
    webservices/axis2/scratch/c/security-policy/c/rampart/samples/client/enc_echo/data/client.enc.axis2.xml
    webservices/axis2/scratch/c/security-policy/c/rampart/samples/server/sec_echo/services.xml
    webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_in_handler.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss10.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss11.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/outgoing_policy.xml
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_encryption.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c
    webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_constants.h?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_constants.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_constants.h Sun Feb 11 20:51:49 2007
@@ -88,8 +88,14 @@
     </xs:element>
 </xs:schema>
 */
+/*    
 #define RAMPART_INFLOW_SECURITY                     "InflowSecurity"
 #define RAMPART_OUTFLOW_SECURITY                    "OutflowSecurity"
+*/
+
+#define RAMPART_INFLOW_SECURITY_POLICY              "InflowSecurityPolicy"
+#define RAMPART_OUTFLOW_SECURITY_POLICY             "OutflowSecurityPolicy"
+
 #define RAMPART_PASSWORD_TEXT                       "passwordText"
 #define RAMPART_PASSWORD_DIGEST                     "passwordDigest"
 #define RAMPART_ACTION                              "action"

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_context.h Sun Feb 11 20:51:49 2007
@@ -24,12 +24,35 @@
 
 #include <rp_includes.h>
 #include <rp_secpolicy.h>
+#include <rampart_authn_provider.h>
+#include <rampart_util.h>
+#include <axis2_property.h>
+#include <rampart_constants.h>
+#include <rampart_callback.h>
+#include <rampart_authn_provider.h>
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
-    
+   
+    typedef axis2_char_t *(AXIS2_CALL*
+            pfunc)(const axis2_env_t *env,
+            const axis2_char_t *username,
+            void *param);
+
+    typedef rampart_authn_provider_status_t (AXIS2_CALL*
+            auth_password_func)(const axis2_env_t* env,
+                const axis2_char_t *username,
+                const axis2_char_t *password);
+
+    typedef rampart_authn_provider_status_t (AXIS2_CALL*
+            auth_digest_func)(const axis2_env_t* env,
+                const axis2_char_t *username,
+                const axis2_char_t *nonce,
+                const axis2_char_t *created,
+                const char *digest);
+
     typedef struct rampart_context_t rampart_context_t;
 
     AXIS2_EXTERN rampart_context_t *AXIS2_CALL
@@ -48,6 +71,56 @@
     rampart_context_set_secpolicy(rampart_context_t *rampart_context,
             const axis2_env_t *env,
             rp_secpolicy_t *secpolicy);
+
+    AXIS2_EXTERN rampart_callback_t *AXIS2_CALL
+    rampart_context_get_password_callback(
+            rampart_context_t *rampart_context,
+            const axis2_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    rampart_context_set_password_callback(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            rampart_callback_t *password_callback_module);
+
+    AXIS2_EXTERN pfunc AXIS2_CALL
+    rampart_context_get_password_function(
+            rampart_context_t *rampart_context,
+            const axis2_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    rampart_context_set_password_function(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            pfunc password_func);
+
+    AXIS2_EXTERN auth_password_func AXIS2_CALL
+    rampart_context_get_auth_password_function(
+            rampart_context_t *rampart_context,
+            const axis2_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    rampart_context_set_auth_password_function(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            auth_password_func authenticate_with_password);
+
+    AXIS2_EXTERN auth_digest_func AXIS2_CALL
+    rampart_context_get_auth_digest_function(
+            rampart_context_t *rampart_context,
+            const axis2_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    rampart_context_set_auth_digest_function(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            auth_digest_func authenticate_with_digest);
+
+    AXIS2_EXTERN rampart_authn_provider_t *AXIS2_CALL
+    rampart_context_get_authn_provider(
+            rampart_context_t *rampart_context,
+            const axis2_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    rampart_context_set_authn_provider(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            rampart_authn_provider_t *authn_provider);
 
     AXIS2_EXTERN int AXIS2_CALL
     rampart_context_get_binding_type(

Added: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_engine.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_engine.h?view=auto&rev=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_engine.h (added)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_engine.h Sun Feb 11 20:51:49 2007
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RAMPART_ENGINE_H
+#define RAMPART_ENGINE_H
+
+/** @defgroup rampart_engine 
+ * @ingroup rampart_engine
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rampart_context.h>
+#include <rp_secpolicy.h>
+#include <rampart_authn_provider.h>
+#include <rampart_util.h>
+#include <axis2_property.h>
+#include <rampart_constants.h>
+#include <rampart_callback.h>
+#include <rp_policy_creator.h>
+#include <rampart_handler_util.h>
+#include <axis2_msg_ctx.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+    
+    AXIS2_EXTERN rampart_context_t* AXIS2_CALL
+    rampart_engine_init(const axis2_env_t *env,
+            axis2_msg_ctx_t *msg_ctx,
+            axis2_char_t *x_flow_policy);
+   
+
+#ifdef __cplusplus
+}
+#endif
+#endif  

Propchange: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_engine.h
------------------------------------------------------------------------------
    svn:executable = *

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_handler_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_handler_util.h?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_handler_util.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_handler_util.h Sun Feb 11 20:51:49 2007
@@ -152,6 +152,14 @@
 rampart_validate_security_token(const axis2_env_t *env,
                                 axis2_msg_ctx_t *msg_ctx,
                                 axiom_node_t *sec_node);  
+
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_get_policy_location(const axis2_env_t *env,
+        axis2_msg_ctx_t *msg_ctx,
+        axis2_char_t *param_name);
+
+
 /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_username_token.h Sun Feb 11 20:51:49 2007
@@ -70,10 +70,7 @@
         axis2_status_t (AXIS2_CALL *
         build)(rampart_username_token_t *username_token,
             const axis2_env_t *env,
-            axis2_char_t *username,
-            axis2_char_t *password_callback_class,
-            axis2_char_t *authn_module_name,
-            axis2_bool_t isdigest,
+            rampart_context_t *rampart_context,
             axiom_node_t *sec_node,
             axiom_namespace_t *sec_ns_obj
             );
@@ -120,8 +117,8 @@
         ((username_token)->ops->build(username_token, env, ctx, actions, sec_node, sec_ns_obj))    
 */
 
-#define RAMPART_USERNAME_TOKEN_BUILD(username_token, env,username,password_callback_class,authn_module_name,isdigest,sec_node, sec_ns_obj) \
-        ((username_token)->ops->build(username_token, env,username,password_callback_class,authn_module_name,isdigest,sec_node, sec_ns_obj))
+#define RAMPART_USERNAME_TOKEN_BUILD(username_token, env,rampart_context,sec_node, sec_ns_obj) \
+        ((username_token)->ops->build(username_token, env,rampart_context,sec_node, sec_ns_obj))
 
 
 #define RAMPART_USERNAME_TOKEN_VALIDATE(username_token, env, msg_ctx, ut_node, rampart_context) \

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/include/rampart_util.h Sun Feb 11 20:51:49 2007
@@ -15,6 +15,7 @@
  */
 
 
+
 #include <axis2_utils_defines.h>
 #include <axis2_defines.h>
 #include <axis2_date_time.h>
@@ -22,9 +23,11 @@
 #include <axis2_property.h>
 #include <axis2_msg_ctx.h>
 #include <rampart_authn_provider.h>
+#include <rampart_credentials.h>
+#include <rampart_callback.h>
 /**
   * @file rampart_util.h
-  * @brief Utilities of rampart 
+  * @brief Utilities of rampart
   */
 #ifndef RAMPART_UTIL_H
 #define RAMPART_UTIL_H
@@ -39,9 +42,43 @@
   */
 
 
+/**
+ * Load a DLL or .SO
+ */
+AXIS2_EXTERN void* AXIS2_CALL
+rampart_load_module(const axis2_env_t *env,
+    axis2_char_t *module_name);
+
+/**
+ *Load the credentials module
+ */
+AXIS2_EXTERN rampart_credentials_t* AXIS2_CALL
+rampart_load_credentials_module(const axis2_env_t *env,
+    axis2_char_t *cred_module_name);
+
+/**
+ *Call credentials module
+ */
+AXIS2_EXTERN rampart_credentials_status_t AXIS2_CALL
+rampart_call_credentials(const axis2_env_t *env,
+    rampart_credentials_t *cred_module,
+    axis2_msg_ctx_t *ctx,
+    axis2_char_t **username,
+    axis2_char_t **password);
+
+/**
+ * Load authentication module
+ */
+AXIS2_EXTERN rampart_authn_provider_t* AXIS2_CALL
+rampart_load_auth_module(const axis2_env_t *env,
+    axis2_char_t *auth_module_name);
+
+/**
+ * Call auth module
+ */
 AXIS2_EXTERN rampart_authn_provider_status_t AXIS2_CALL
 rampart_authenticate_un_pw(const axis2_env_t *env,
-    axis2_char_t *authn_module_name,
+    rampart_authn_provider_t *authp,
     const axis2_char_t *username,
     const axis2_char_t *password,
     const axis2_char_t *nonce,/*Can be NULL if plain text*/
@@ -49,24 +86,34 @@
     const axis2_char_t *password_type,
     axis2_msg_ctx_t *msg_ctx);
 
+/**
+ * Load the password callback module
+ *
+ */
+AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
+rampart_load_pwcb_module(const axis2_env_t *env,
+        axis2_char_t *callback_module_name);
+
  /**
-	*@env the environment
-	*@callback_module_name the file name of the callback module (.so or .DLL)
-	*@username the name of the user to get the password
-	*@ctx The axis2 context
-	*@return the password for the user or NULL if failed
-	*/
+    *@env the environment
+    *@callback_module_name the file name of the callback module (.so or .DLL)
+    *@username the name of the user to get the password
+    *@ctx The axis2 context
+    *@return the password for the user or NULL if failed
+    */
+
+
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 rampart_callback_password(const axis2_env_t *env,
-        axis2_char_t *callback_module_name,
+        rampart_callback_t *callback_module,
         const axis2_char_t *username);
 
- /**
+/**
     * Generates the nonce. Nonce is a base64 encoded random string.
-	* @env the environment
+    * @env the environment
     * @return generated nonce
-    */    
+    */
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    rampart_generate_nonce(const axis2_env_t *env);
@@ -75,15 +122,15 @@
     * Generates the nonce. Nonce is a base64 encoded random string.
     * @param ttl Time to live. The time difference between created and expired in mili seconds.
     * @return generated nonce
-    **/    
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL 
+    **/
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 rampart_generate_time(const axis2_env_t *env, int ttl);
 
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_compare_date_time(const axis2_env_t *env, axis2_char_t *dt1, axis2_char_t *dt2);
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_print_info(const axis2_env_t *env, axis2_char_t* info);
 
 /* @} */
@@ -92,3 +139,5 @@
 #endif
 
 #endif    /* !RAMPART_UTIL_H */
+                                                                                                                           
+

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/samples/client/enc_echo/data/client.enc.axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/samples/client/enc_echo/data/client.enc.axis2.xml?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/samples/client/enc_echo/data/client.enc.axis2.xml (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/samples/client/enc_echo/data/client.enc.axis2.xml Sun Feb 11 20:51:49 2007
@@ -19,32 +19,8 @@
     </hostConfiguration>
     
     <!--Rampart configurations START -->
-    <parameter name="OutflowSecurity">
-      <action>
-        <items>UsernameToken Timestamp Encrypt</items>
-        <user>Gampola</user>
-        <passwordType>passwordDigest</passwordType>
-        <!--Following should be changed with your DLL or SO path-->
-        <passwordCallbackClass>/home/kau/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so</passwordCallbackClass>
-        <timeToLive>360</timeToLive>
-        <encryptionKeyTransportAlgorithm>http://www.w3.org/2001/04/xmlenc#rsa-1_5</encryptionKeyTransportAlgorithm>
-        <encryptionSymAlgorithm>http://www.w3.org/2001/04/xmlenc#aes256-cbc</encryptionSymAlgorithm>  
-        <encryptionPropFile>/home/kau/axis2/c/rampart/samples/keys/ahome/b_cert.cert</encryptionPropFile>
-        <!--encryptionKeyIdentifier options : Embedded IssuerSerial DirectReference KeyIdentifier-->
-        <encryptionKeyIdentifier>IssuerSerial</encryptionKeyIdentifier>
-      </action>
-    </parameter>
-
-
-    <parameter name="InflowSecurity">
-      <action>
-        <items>Timestamp</items>
-        <!--Following should be changed with your DLL or SO path-->
-        <passwordCallbackClass>/home/kau/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so</passwordCallbackClass>
-        <decryptionPropFile>/home/kau/axis2/c/rampart/samples/keys/ahome/a_store.pfx</decryptionPropFile>
-        <encryptionUser>a</encryptionUser>
-      </action>
-    </parameter>
+    <parameter name="OutflowSecurityPolicy">/home/manjula/axis2/scratch/security-policy/c/deploy/client_repo/outgoing_policy.xml</parameter>
+    <parameter name="InflowSecurityPolicy">/home/manjula/axis2/scratch/security-policy/c/deploy/client_repo/incoming_policy.xml</parameter>
     <!--Rampart configurations END -->
 
 

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/samples/server/sec_echo/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/samples/server/sec_echo/services.xml?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/samples/server/sec_echo/services.xml (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/samples/server/sec_echo/services.xml Sun Feb 11 20:51:49 2007
@@ -6,34 +6,8 @@
    </description>
     <!--Rampart configurations START -->
     <module ref="rampart"/>
-
-    <parameter name="OutflowSecurity">
-      <action>
-        <items>Timestamp</items>
-        <user>Gampola</user>
-        <passwordType>passwordDigest</passwordType>
-        <!--Following should be changed with your DLL or SO path-->
-        <passwordCallbackClass>/home/kau/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so</passwordCallbackClass>
-        <timeToLive>360</timeToLive>
-        <encryptionKeyTransportAlgorithm>http://www.w3.org/2001/04/xmlenc#rsa-1_5</encryptionKeyTransportAlgorithm>
-        <encryptionSymAlgorithm>http://www.w3.org/2001/04/xmlenc#aes256-cbc</encryptionSymAlgorithm>
-        <encryptionPropFile>/home/kau/axis2/c/rampart/samples/keys/bhome/a_cert.cert</encryptionPropFile>
-        <!--encryptionKeyIdentifier options : Embedded IssuerSerial DirectReference KeyIdentifier-->
-        <encryptionKeyIdentifier>IssuerSerial</encryptionKeyIdentifier>
-      </action>
-    </parameter>
-
-
-    <!--passwordCallbackClass should be changed with your DLL or SO path-->
-    <parameter name="InflowSecurity">
-      <action>
-        <items>UsernameToken Timestamp Encrypt</items>
-        <passwordCallbackClass>/home/kau/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so</passwordCallbackClass>
-        <authnModuleName>/home/kau/axis2/c/deploy/bin/samples/rampart/authn_provider/libauthn.so</authnModuleName>
-        <decryptionPropFile>/home/kau/axis2/c/rampart/samples/keys/bhome/b_store.pfx</decryptionPropFile>
-        <encryptionUser>b</encryptionUser>
-      </action>
-    </parameter>
+    <parameter name="OutflowSecurityPolicy">/home/manjula/axis2/scratch/security-policy/c/rampart/src/secpolicy/test-resources/outgoing_policy.xml</parameter>
+    <parameter name="InflowSecurityPolicy">/home/manjula/axis2/scratch/security-policy/c/rampart/src/secpolicy/test-resources/incoming_policy.xml</parameter>    
     <!--Rampart configurations END -->
 
     <operation name="echoString">

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_in_handler.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_in_handler.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_in_handler.c Sun Feb 11 20:51:49 2007
@@ -36,7 +36,7 @@
 #include <rp_policy_creator.h>
 #include <rp_secpolicy_builder.h>
 #include <rampart_context.h>
-
+#include <rampart_engine.h>
 
 /*************************** Function headers *********************************/
 
@@ -75,22 +75,22 @@
     axiom_soap_header_t *soap_header = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     axiom_node_t *sec_node = NULL;
-    rp_secpolicy_t *secpolicy = NULL;
     rampart_context_t *rampart_context = NULL;
 /*  axis2_char_t *file_name = "/home/manjula/axis2/scratch/security-policy/c/rampart/src/secpolicy/test-resources/2.xml";*/
-    axis2_char_t *file_name = NULL;
+/*  axis2_char_t *file_name = NULL;*/
     axis2_bool_t serverside =  AXIS2_FALSE;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
 
     serverside = axis2_msg_ctx_get_server_side(msg_ctx,env);
-
+/*
     if(serverside)
         file_name = "/home/manjula/axis2/scratch/security-policy/c/rampart/src/secpolicy/test-resources/incoming_policy.xml";
     
     else            
         file_name = "/home/manjula/axis2/scratch/security-policy/c/deploy/client_repo/incoming_policy.xml";
+*/
 
     soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, env);
     if(!soap_envelope)
@@ -108,23 +108,9 @@
     }
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "SOAP header found");
 
-    secpolicy = rp_policy_create_from_file(env,file_name);
-    
-    if(!secpolicy)
-    {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Cannot get policy" );
-         /*No policy so we cant proceed.*/
-        return AXIS2_FAILURE;
-    }
-    rampart_context = rampart_context_create(env);
+    rampart_context = rampart_engine_init(env,msg_ctx,RAMPART_INFLOW_SECURITY_POLICY);
     if(!rampart_context)
-    {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Cannot get Rampart Data " );
-        /*No policy so we cant proceed.*/
         return AXIS2_FAILURE;
-    }
-
-    rampart_context_set_secpolicy(rampart_context,env,secpolicy);
 
     sec_node = rampart_get_security_token(env, msg_ctx, soap_header);
     
@@ -145,8 +131,6 @@
     status = rampart_shp_process_message(env, msg_ctx, rampart_context, 
 						soap_envelope, sec_node);
         
-    rp_secpolicy_free(secpolicy,env);
-    secpolicy = NULL;
 /*    
     rampart_context_free(rampart_context,env);
     rampart_context = NULL;

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/handlers/rampart_out_handler.c Sun Feb 11 20:51:49 2007
@@ -32,6 +32,7 @@
 #include <rp_policy_creator.h>
 #include <rp_secpolicy_builder.h>
 #include <rampart_context.h>
+#include <rampart_engine.h>
 
 /*********************** Function headers *********************************/
 
@@ -74,9 +75,9 @@
     axiom_element_t *soap_header_ele = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     rampart_context_t *rampart_context = NULL;
-    rp_secpolicy_t *secpolicy = NULL;
+/*  rp_secpolicy_t *secpolicy = NULL;*/
 /*  axis2_char_t *file_name = "/home/manjula/axis2/scratch/security-policy/c/rampart/src/secpolicy/test-resources/2.xml";*/
-    axis2_char_t *file_name = NULL;
+/*  axis2_char_t *file_name = NULL;*/
     axis2_bool_t serverside = AXIS2_FALSE;
     
 
@@ -84,13 +85,13 @@
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
 
     serverside = axis2_msg_ctx_get_server_side(msg_ctx,env);
-
+/*
     if(serverside)
         file_name = "/home/manjula/axis2/scratch/security-policy/c/rampart/src/secpolicy/test-resources/outgoing_policy.xml";
 
     else
         file_name = "/home/manjula/axis2/scratch/security-policy/c/deploy/client_repo/outgoing_policy.xml";
-
+*/
     soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, env);
     if (!soap_envelope)
     {
@@ -120,27 +121,10 @@
         }
         soap_header_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(soap_header_node,env);
 
-        /*Create security-policy object.Currently from file directly. this
-          can be changed to get it from a axiom_node. */
-
-        secpolicy = rp_policy_create_from_file(env,file_name);
-
-        if(!secpolicy)
-        {
-            AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Cannot get policy" );
-            /*No policy so we cant proceed.*/
-            return AXIS2_FAILURE;
-        }
-        rampart_context = rampart_context_create(env);
-
+        rampart_context = rampart_engine_init(env,msg_ctx,RAMPART_OUTFLOW_SECURITY_POLICY);
         if(!rampart_context)
-        {
-            AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Cannot get Rampart Data " );
-            /*No policy so we cant proceed.*/
             return AXIS2_FAILURE;
-        }
 
-        rampart_context_set_secpolicy(rampart_context,env,secpolicy); 
         /*We call the security header builder*/
         status = rampart_shb_build_message(env, msg_ctx, rampart_context, soap_envelope);
         if(AXIS2_FAILURE == status){
@@ -148,8 +132,6 @@
                     "[rampart][rampart_out_handler] Security header building failed ERROR");
         }
     }
-    rp_secpolicy_free(secpolicy,env);
-    secpolicy = NULL;
 
     return status;
     

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss10.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss10.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss10.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss10.c Sun Feb 11 20:51:49 2007
@@ -25,6 +25,7 @@
     axis2_bool_t must_support_ref_issuer_serial;
     axis2_bool_t must_support_ref_external_uri;
     axis2_bool_t must_support_ref_embedded_token;
+    axis2_bool_t must_support_direct_reference;
 };
 
 AXIS2_EXTERN rp_wss10_t *AXIS2_CALL
@@ -46,7 +47,8 @@
     wss10->must_support_ref_issuer_serial  = AXIS2_FALSE;
     wss10->must_support_ref_external_uri = AXIS2_FALSE;
     wss10->must_support_ref_embedded_token = AXIS2_FALSE;
-        
+    wss10->must_support_direct_reference = AXIS2_TRUE;
+
     return wss10;
 
 }

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss11.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss11.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss11.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/model/wss11.c Sun Feb 11 20:51:49 2007
@@ -28,6 +28,7 @@
     axis2_bool_t must_support_ref_thumbprint;
     axis2_bool_t must_support_ref_encryptedkey;
     axis2_bool_t require_signature_confirmation;
+    axis2_bool_t must_support_direct_reference;
 };
 
 AXIS2_EXTERN rp_wss11_t *AXIS2_CALL
@@ -52,6 +53,8 @@
     wss11->must_support_ref_thumbprint = AXIS2_FALSE;
     wss11->must_support_ref_encryptedkey = AXIS2_FALSE;
     wss11->require_signature_confirmation = AXIS2_FALSE;
+    wss11->must_support_direct_reference = AXIS2_TRUE;
+
     return wss11;
 
 }

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/outgoing_policy.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/outgoing_policy.xml?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/outgoing_policy.xml (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/secpolicy/test-resources/outgoing_policy.xml Sun Feb 11 20:51:49 2007
@@ -41,9 +41,6 @@
 					<sp:MustSupportRefIssuerSerial/>
 				</wsp:Policy>
             </sp:Wss10>
-            <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
-                <sp:Body/>
-            </sp:EncryptedParts>
             <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
                 <rampc:user>Gampola</rampc:user>
                 <rampc:encryptionUser>b</rampc:encryptionUser>

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/Makefile.am Sun Feb 11 20:51:49 2007
@@ -5,7 +5,7 @@
 librampart_util_la_SOURCES = rampart_action.c rampart_crypto_util.c \
 							rampart_util.c rampart_handler_util.c username_token.c  timestamp_token.c \
 							rampart_encryption.c rampart_sec_header_processor.c rampart_sec_processed_result.c \
-							rampart_sec_header_builder.c rampart_context.c
+							rampart_sec_header_builder.c rampart_context.c rampart_engine.c
 
 
 librampart_util_la_LIBADD  = -lssl \

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_context.c Sun Feb 11 20:51:49 2007
@@ -20,9 +20,18 @@
 #include <oxs_axiom.h>
 
 
+
+
 struct rampart_context_t
 {
     rp_secpolicy_t *secpolicy;
+    rampart_callback_t* password_callback_module;
+    rampart_authn_provider_t *authn_provider;
+    
+    /*Function pointers for php extension to assign*/
+    pfunc password_func; 
+    auth_password_func authenticate_with_password;
+    auth_digest_func authenticate_with_digest;
 };
 
 
@@ -78,7 +87,12 @@
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-    rampart_context->secpolicy= NULL;
+    rampart_context->secpolicy = NULL;
+    rampart_context->password_callback_module = NULL; 
+    rampart_context->authn_provider = NULL;
+    rampart_context->password_func = NULL;
+    rampart_context->authenticate_with_password = NULL;
+    rampart_context->authenticate_with_digest = NULL;
 
     return rampart_context;
 }
@@ -127,6 +141,130 @@
     return AXIS2_SUCCESS;
 }
 
+
+AXIS2_EXTERN rampart_callback_t *AXIS2_CALL
+rampart_context_get_password_callback(
+    rampart_context_t *rampart_context,
+    const axis2_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    return rampart_context->password_callback_module;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_context_set_password_callback(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            rampart_callback_t *password_callback_module)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error,password_callback_module,AXIS2_FAILURE);
+
+    rampart_context->password_callback_module = password_callback_module;
+    return AXIS2_SUCCESS;
+}
+
+/*This function get the function pointer of the password callback function*/
+
+AXIS2_EXTERN pfunc AXIS2_CALL
+rampart_context_get_password_function(
+    rampart_context_t *rampart_context,
+    const axis2_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    return rampart_context->password_func;
+}
+
+/*set the password callback function*/
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_context_set_password_function(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            pfunc password_func)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error,password_func,AXIS2_FAILURE);
+
+    rampart_context->password_func = password_func;
+    return AXIS2_SUCCESS;
+}
+
+/*The 4 functions below deals with setting and getting authentication 
+ *module function pointers */
+
+AXIS2_EXTERN auth_password_func AXIS2_CALL
+rampart_context_get_auth_password_function(
+    rampart_context_t *rampart_context,
+    const axis2_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    return rampart_context->authenticate_with_password;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_context_set_auth_password_function(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            auth_password_func authenticate_with_password)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error,authenticate_with_password,AXIS2_FAILURE);
+
+    rampart_context->authenticate_with_password = authenticate_with_password;
+    return AXIS2_SUCCESS;
+}
+
+
+
+AXIS2_EXTERN auth_digest_func AXIS2_CALL
+rampart_context_get_auth_digest_function(
+    rampart_context_t *rampart_context,
+    const axis2_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    return rampart_context->authenticate_with_digest;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_context_set_auth_digest_function(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            auth_digest_func authenticate_with_digest)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error,authenticate_with_digest,AXIS2_FAILURE);
+
+    rampart_context->authenticate_with_digest = authenticate_with_digest;
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rampart_authn_provider_t *AXIS2_CALL
+rampart_context_get_authn_provider(
+    rampart_context_t *rampart_context,
+    const axis2_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    return rampart_context->authn_provider;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_context_set_authn_provider(rampart_context_t *rampart_context,
+            const axis2_env_t *env,
+            rampart_authn_provider_t *authn_provider)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error,authn_provider,AXIS2_FAILURE);
+
+    rampart_context->authn_provider = authn_provider;
+    return AXIS2_SUCCESS;
+}
+
+
+
 AXIS2_EXTERN int AXIS2_CALL
 rampart_context_get_binding_type(
     rampart_context_t *rampart_context,
@@ -439,7 +577,7 @@
         
         return identifier;                                         
     }
-    else if(rp_property_get_type(wss,env)==RP_WSS_WSS10)
+    else if(rp_property_get_type(wss,env)==RP_WSS_WSS11)
     {
         rp_wss11_t *wss11 = NULL;
         wss11 = rp_property_get_value(wss,env);
@@ -710,18 +848,15 @@
     if(rp_property_get_type(binding,env)==RP_BINDING_ASYMMETRIC)
     {
         rp_asymmetric_binding_t *asym_binding = NULL;
-        printf("Inside Binding Asymmetric\n");
         asym_binding = (rp_asymmetric_binding_t *)rp_property_get_value(binding,env);
         if(asym_binding)
         {
             if((for_encryption && server_side) || (!for_encryption && !server_side))
             {
-                printf("Getting Initiator Token\n");
                 return rp_asymmetric_binding_get_initiator_token(asym_binding,env);
             }    
             else if((for_encryption && !server_side) || (!for_encryption && server_side))
             {
-                printf("Getting Recipient Token\n");
                 return rp_asymmetric_binding_get_recipient_token(asym_binding,env);
             }
             else return NULL;

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_encryption.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_encryption.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_encryption.c Sun Feb 11 20:51:49 2007
@@ -121,7 +121,9 @@
     int token_type = 0;   
     rp_property_t *token = NULL;
     axis2_char_t *enc_user = NULL;
-    axis2_char_t *pw_callback_module = NULL;
+    rampart_callback_t *password_callback = NULL;
+    pfunc password_function = NULL;
+    void *param = NULL;
 
     int i = 0;
     /*Get nodes to be encrypted*/
@@ -213,17 +215,22 @@
         enc_user = rampart_context_get_user(rampart_context,env);
 
     if(!enc_user)
-        return AXIS2_FAILURE;            
+        return AXIS2_FAILURE;      
 
-    pw_callback_module = rampart_context_get_password_callback_class(rampart_context,env);
-    if(!pw_callback_module)
-    {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] Password call back module is not specified.");
-        return AXIS2_FAILURE;
-    }        
-
-    password = rampart_callback_password(env, pw_callback_module, enc_user);
+    password_function = rampart_context_get_password_function(rampart_context,env);
+    if(password_function)
+        password = (*password_function)(env,enc_user,param);
 
+    else
+    {
+        password_callback = rampart_context_get_password_callback(rampart_context,env);
+        if(!password_callback)
+        {
+            AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] Password call back module is not loaded.");
+            return AXIS2_FAILURE;
+        }        
+        password = rampart_callback_password(env, password_callback, enc_user);
+    }
 /*  password = rampart_callback_encuser_password(env, actions, msg_ctx);*/
     /*Get encryption key identifier*/
     eki = rampart_context_get_enc_key_identifier(rampart_context,token,server_side,env);

Added: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_engine.c?view=auto&rev=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_engine.c (added)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_engine.c Sun Feb 11 20:51:49 2007
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* 
+ *
+ */
+
+#include <rampart_engine.h>
+
+/*This method sets all the configurations
+ loads required modules and start rampart.*/
+
+
+AXIS2_EXTERN rampart_context_t* AXIS2_CALL
+rampart_engine_init(const axis2_env_t *env, 
+        axis2_msg_ctx_t *msg_ctx,
+        axis2_char_t *x_flow_policy)
+{
+
+    axis2_char_t *file_name = NULL;
+    rampart_context_t *rampart_context = NULL;
+    rp_secpolicy_t *secpolicy = NULL;
+    rampart_callback_t* password_callback_module = NULL;
+    rampart_authn_provider_t *authn_provider = NULL;
+    axis2_char_t *pwcb_module_name = NULL;
+    axis2_char_t *authn_provider_name = NULL;
+        
+    file_name = rampart_get_policy_location(env,msg_ctx,x_flow_policy);
+    if(!file_name)
+    {
+        AXIS2_LOG_INFO(env->log,
+         "[rampart][rampart_Engine] No Security in the flow. So nothing to do");
+        return NULL;
+    }
+
+    secpolicy = rp_policy_create_from_file(env,file_name);
+
+    if(!secpolicy)
+    {
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_Engine] Cannot get policy" );
+        /*No policy so we cant proceed.*/
+        return NULL;
+    }
+    rampart_context = rampart_context_create(env);
+
+    if(!rampart_context)
+    {
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_Engine] Cannot get Rampart Context " );
+        /*No policy so we cant proceed.*/
+        return NULL;
+    }
+        
+    rampart_context_set_secpolicy(rampart_context,env,secpolicy);
+
+    pwcb_module_name = rampart_context_get_password_callback_class(rampart_context,env);
+
+    if(pwcb_module_name)
+    {
+        password_callback_module = rampart_load_pwcb_module(env,pwcb_module_name);
+        if(password_callback_module)
+            rampart_context_set_password_callback(rampart_context,env,password_callback_module);        
+    }
+    authn_provider_name = rampart_context_get_authn_module_name(rampart_context,env);
+    
+    if(authn_provider_name)
+    {
+        authn_provider = rampart_load_auth_module(env,authn_provider_name);
+        if(authn_provider)
+            rampart_context_set_authn_provider(rampart_context,env,authn_provider);
+    }
+    return rampart_context;
+}

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_handler_util.c Sun Feb 11 20:51:49 2007
@@ -72,6 +72,11 @@
         axis2_msg_ctx_t *msg_ctx,
         axiom_node_t *sec_node);
 
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_get_policy_location(const axis2_env_t *env,
+        axis2_msg_ctx_t *msg_ctx,
+        axis2_char_t *param_name);
+
 /**********************end of header functions ****************************/
 
 axis2_char_t* AXIS2_CALL
@@ -110,7 +115,7 @@
     /*Get axis2_ctx_t. This is designed specially for PHP*/
 
 /*  password = rampart_callback_password(env, pw_callback_module, enc_user, ctx);*/
-    password = rampart_callback_password(env, pw_callback_module, enc_user);
+/*  password = rampart_callback_password(env, pw_callback_module, enc_user);*/
 
     return password;
 }
@@ -314,5 +319,28 @@
     }
 
     return AXIS2_SUCCESS;
+}
+
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rampart_get_policy_location(const axis2_env_t *env,
+        axis2_msg_ctx_t *msg_ctx,
+        axis2_char_t *param_name)
+        
+{
+    axis2_param_t *param_x_flow_security = NULL;
+    axis2_char_t *value = NULL;
+
+    param_x_flow_security = rampart_get_security_param(env, msg_ctx,
+                                    param_name);
+    
+    if (!param_x_flow_security)
+    {
+        AXIS2_LOG_INFO(env->log,
+            "[rampart][rampart_handler_utils] some error in the configurations");
+        return NULL;
+    }
+    value = AXIS2_PARAM_GET_VALUE(param_x_flow_security, env);
+    return value;
 }
 

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_builder.c Sun Feb 11 20:51:49 2007
@@ -121,24 +121,16 @@
         {            
             if(rampart_context_is_include_username_token(rampart_context,env))
             {
-                axis2_char_t *user = NULL;
-                axis2_char_t *password_callback = NULL;
-                axis2_bool_t is_digest = AXIS2_FALSE;
                 rampart_username_token_t *username_token = NULL;
 
-                user = rampart_context_get_user(rampart_context,env);
-                password_callback = rampart_context_get_password_callback_class(rampart_context,env);
-                is_digest = rampart_context_get_password_type(rampart_context,env);
-
                 username_token = rampart_username_token_create(env);
+        /*Now we are passing rampart_context here so inside this method user can 
+        relevant parameters are extracted. */
 
                 AXIS2_LOG_INFO(env->log, "[rampart][shb]  building UsernmaeToken");
                 status = RAMPART_USERNAME_TOKEN_BUILD(username_token,
                                 env,
-                                user,
-                                password_callback,
-                                NULL,
-                                is_digest,
+                                rampart_context,
                                 sec_node,
                                 sec_ns_obj);
                 if (status == AXIS2_FAILURE)

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_sec_header_processor.c Sun Feb 11 20:51:49 2007
@@ -226,12 +226,14 @@
     axis2_char_t *dec_key_file = NULL;
     axis2_char_t *password = NULL;
     axis2_char_t *enc_user = NULL;
-    axis2_char_t *pw_callback_module = NULL;
+    rampart_callback_t *password_callback = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     oxs_asym_ctx_t *asym_ctx = NULL;
     oxs_key_t *decrypted_sym_key = NULL;
     axis2_char_t *enc_asym_algo_in_pol = NULL; 
     axis2_char_t *enc_sym_algo_in_pol = NULL;
+    pfunc password_function = NULL;
+    void *param = NULL;
     int i = 0;
     
     /*Get EncryptedData references */
@@ -279,15 +281,21 @@
     if(!enc_user)
         return AXIS2_FAILURE;
 
-    pw_callback_module = rampart_context_get_password_callback_class(rampart_context,env);
-    if(!pw_callback_module)
+    password_function = rampart_context_get_password_function(rampart_context,env);
+    if(password_function)
+        password = (*password_function)(env,enc_user,param);
+
+    else
     {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] Password call back module is not specified.");
-        return AXIS2_FAILURE;
+        password_callback = rampart_context_get_password_callback(rampart_context,env);
+        if(!password_callback)
+        {
+            AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] Password call back module is not specified.");
+            return AXIS2_FAILURE;
+        }
+        password = rampart_callback_password(env, password_callback, enc_user);
     }
-
-    password = rampart_callback_password(env, pw_callback_module, enc_user);
-
+    
     oxs_asym_ctx_set_algorithm(asym_ctx, env, enc_asym_algo);
     oxs_asym_ctx_set_file_name(asym_ctx, env, dec_key_file);
     

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/rampart_util.c Sun Feb 11 20:51:49 2007
@@ -29,6 +29,7 @@
 #include <axis2_msg_ctx.h>
 #include <rampart_constants.h>
 #include <rampart_callback.h>
+#include <rampart_credentials.h>
 
 /*Calculate the hash of concatenated string of
  * nonce, created and the password.
@@ -41,105 +42,136 @@
 
 /*#define PRINTINFO 1 */
 
-AXIS2_EXTERN rampart_authn_provider_status_t AXIS2_CALL
-rampart_authenticate_un_pw(const axis2_env_t *env,
-    axis2_char_t *authn_module_name,
-    const axis2_char_t *username,
-    const axis2_char_t *password,
-    const axis2_char_t *nonce,/*Can be NULL if plain text*/
-    const axis2_char_t *created,/*Can be NULL if plain text*/
-    const axis2_char_t *password_type,
-    axis2_msg_ctx_t *msg_ctx)
+AXIS2_EXTERN void* AXIS2_CALL
+rampart_load_module(const axis2_env_t *env,
+    axis2_char_t *module_name)
 {
-    rampart_authn_provider_t *authp = NULL;
     axis2_dll_desc_t *dll_desc = NULL;
     axis2_param_t *impl_info_param = NULL;
     void *ptr = NULL;
-    rampart_authn_provider_status_t auth_status = RAMPART_AUTHN_PROVIDER_GENERAL_ERROR;
 
     dll_desc = axis2_dll_desc_create(env);
-    AXIS2_DLL_DESC_SET_NAME(dll_desc, env, authn_module_name);
+    AXIS2_DLL_DESC_SET_NAME(dll_desc, env, module_name);
     impl_info_param = axis2_param_create(env, NULL, NULL);
     AXIS2_PARAM_SET_VALUE(impl_info_param, env, dll_desc);
     axis2_class_loader_init(env);
     ptr = axis2_class_loader_create_dll(env, impl_info_param);
-    
+
     if (!ptr)
     {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to load the authentication module %s. ERROR", authn_module_name);
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to load the module %s. ERROR", module_name);
+        return NULL;
+    }
+
+    return ptr;
+}
+
+AXIS2_EXTERN rampart_credentials_status_t AXIS2_CALL
+rampart_call_credentials(const axis2_env_t *env,
+    rampart_credentials_t *cred_module,
+    axis2_msg_ctx_t *msg_ctx,
+    axis2_char_t **username,
+    axis2_char_t **password)
+{
+    rampart_credentials_status_t cred_status = RAMPART_CREDENTIALS_GENERAL_ERROR;
+
+    cred_status = RAMPART_CREDENTIALS_USERNAME_GET(cred_module, env, msg_ctx, username, password);
+    return cred_status;
+}
+
+AXIS2_EXTERN rampart_credentials_t* AXIS2_CALL
+rampart_load_credentials_module(const axis2_env_t *env,
+    axis2_char_t *cred_module_name)
+{
+    rampart_credentials_t *cred = NULL;
+
+    cred = (rampart_credentials_t*)rampart_load_module(env, cred_module_name);
+    if (!cred)
+    {
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify the credentials  module %s. ERROR", cred_module_name);
         return AXIS2_FAILURE;
     }
 
-    authp = (rampart_authn_provider_t*)ptr;
+    return cred;
+}
+
+AXIS2_EXTERN rampart_authn_provider_t* AXIS2_CALL
+rampart_load_auth_module(const axis2_env_t *env,
+    axis2_char_t *auth_module_name)
+{
+    rampart_authn_provider_t *authp = NULL;
+
+    authp = (rampart_authn_provider_t*)rampart_load_module(env, auth_module_name);
     if (!authp)
     {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify the authentication  module %s. ERROR", authn_module_name);
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify the authentication module %s. ERROR", auth_module_name);
         return AXIS2_FAILURE;
     }
+
+    return authp;
+}
+
+AXIS2_EXTERN rampart_authn_provider_status_t AXIS2_CALL
+rampart_authenticate_un_pw(const axis2_env_t *env,
+    rampart_authn_provider_t *authp,
+    const axis2_char_t *username,
+    const axis2_char_t *password,
+    const axis2_char_t *nonce,/*Can be NULL if plain text*/
+    const axis2_char_t *created,/*Can be NULL if plain text*/
+    const axis2_char_t *password_type,
+    axis2_msg_ctx_t *msg_ctx)
+{
+    rampart_authn_provider_status_t auth_status = RAMPART_AUTHN_PROVIDER_GENERAL_ERROR;
+
+    if (!authp)
+    {
+        return RAMPART_AUTHN_PROVIDER_GENERAL_ERROR;
+    }
     /*If password digest*/
     if(0 == AXIS2_STRCMP(password_type, RAMPART_PASSWORD_DIGEST_URI)){
         auth_status = RAMPART_AUTHN_PROVIDER_CHECK_PASSWORD_DIGEST(authp, env, msg_ctx, username, nonce, created, password);
     }else{
-        auth_status = RAMPART_AUTHN_PROVIDER_CHECK_PASSWORD(authp, env, msg_ctx, username, password);    
+        auth_status = RAMPART_AUTHN_PROVIDER_CHECK_PASSWORD(authp, env, msg_ctx, username, password);
     }
 
     return auth_status;
 }
 
+AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
+rampart_load_pwcb_module(const axis2_env_t *env,
+        axis2_char_t *callback_module_name)
+{
+    rampart_callback_t *cb = NULL;
+
+    cb = (rampart_callback_t*)rampart_load_module(env, callback_module_name);
+    if (!cb)
+    {
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify the callback module %s. ERROR", callback_module_name);
+        return AXIS2_FAILURE;
+    }
+
+    return cb;
+
+}
+
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 rampart_callback_password(const axis2_env_t *env,
-        axis2_char_t *callback_module_name,
+        rampart_callback_t *callback_module,
         const axis2_char_t *username)
 {
-    rampart_callback_t* rcb = NULL;
     axis2_char_t *password = NULL;
-    axis2_dll_desc_t *dll_desc = NULL;
-    void *ptr = NULL;
-    axis2_param_t *impl_info_param = NULL;
-/*  axis2_property_t* property = NULL; */
     void *cb_prop_val= NULL;
 
-    /*Get callback specific property if any from the ctx. This is specially done for PHP folks to send the htpassword file location.
-     */
-    /*since we use policy we need not these*/
-/*    property = AXIS2_CTX_GET_PROPERTY(ctx, env, RAMPART_CALLBACK_SPECIFIC_PROPERTY, AXIS2_FALSE);
-    if (property)
-    {
-        cb_prop_val = AXIS2_PROPERTY_GET_VALUE(property, env);
-        property = NULL;
-    }
-*/
-    dll_desc = axis2_dll_desc_create(env);
-    AXIS2_DLL_DESC_SET_NAME(dll_desc, env, callback_module_name);
-    impl_info_param = axis2_param_create(env, NULL, NULL);
-    AXIS2_PARAM_SET_VALUE(impl_info_param, env, dll_desc);
-    axis2_class_loader_init(env);
-    ptr = axis2_class_loader_create_dll(env, impl_info_param);
-
-    /*callback()*/
-    if (!ptr)
-    {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] Unable to create the pw callback module %s. ERROR", callback_module_name);
-        return NULL;
-    }
-
-    rcb = (rampart_callback_t*)ptr;
-    if (!rcb)
-    {
-        AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] Unable to load the pw callback module %s. ERROR", callback_module_name);
-        return NULL;
-    }
-
     /*Get the password thru the callback*/
-    password = RAMPART_CALLBACK_CALLBACK_PASSWORD(rcb, env, username, cb_prop_val);
+    password = RAMPART_CALLBACK_CALLBACK_PASSWORD(callback_module, env, username, cb_prop_val);
 
-    AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] Password taken from the callback module %s. SUCCESS", callback_module_name);
+    AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] Password taken from the callback module . SUCCESS");
     return password;
-    
 }
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL rampart_generate_nonce(const axis2_env_t *env)
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+rampart_generate_nonce(const axis2_env_t *env)
 {
     oxs_buffer_t *buffer = NULL;
     axis2_status_t status = AXIS2_FAILURE;
@@ -157,7 +189,8 @@
 }
 
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL rampart_generate_time(const axis2_env_t *env, int ttl)
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+rampart_generate_time(const axis2_env_t *env, int ttl)
 {
     axis2_date_time_t *dt = NULL;
     axis2_char_t *dt_str = NULL;
@@ -168,9 +201,7 @@
     return dt_str;
 }
 
-/**
-    We expect dt1_str < dt2_str/ Otherwise FAILURE
-*/
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_compare_date_time(const axis2_env_t *env, axis2_char_t *dt1_str, axis2_char_t *dt2_str)
 {
@@ -212,7 +243,7 @@
     ss2 = AXIS2_DATE_TIME_GET_SECOND(dt2, env);
     ml2 = AXIS2_DATE_TIME_GET_MSEC(dt2, env);
     /**
-    Comparison. 
+    Comparison.
     We expect dt1_str < dt2_str/ Otherwise FAILURE
     */
     if (yyyy1 < yyyy2)
@@ -250,8 +281,7 @@
     {
         return AXIS2_FAILURE;
     }
-
-    if (mi1 < mi2)
+     if (mi1 < mi2)
     {
         return AXIS2_SUCCESS;
     }
@@ -276,7 +306,7 @@
     else if (ml1 > ml2)
     {
         return AXIS2_FAILURE;
-    } 
+    }
 
     /*AXIS2_DATE_TIME_FREE(dt1, env);
     AXIS2_DATE_TIME_FREE(dt2, env);*/
@@ -292,3 +322,6 @@
 #endif
     return AXIS2_SUCCESS;
 }
+
+
+

Modified: webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c?view=diff&rev=506281&r1=506280&r2=506281
==============================================================================
--- webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c (original)
+++ webservices/axis2/scratch/c/security-policy/c/rampart/src/util/username_token.c Sun Feb 11 20:51:49 2007
@@ -70,10 +70,7 @@
 axis2_status_t AXIS2_CALL
 rampart_username_token_build(rampart_username_token_t *username_token,
         const axis2_env_t *env,
-        axis2_char_t *username,
-        axis2_char_t *password_callback_class,
-        axis2_char_t *authn_module_name,
-        axis2_bool_t isdigest,
+        rampart_context_t *rampart_context,
         axiom_node_t *sec_node,
         axiom_namespace_t *sec_ns_obj);
 
@@ -155,10 +152,7 @@
 axis2_status_t AXIS2_CALL
 rampart_username_token_build(rampart_username_token_t *username_token,
         const axis2_env_t *env,
-        axis2_char_t *username,
-        axis2_char_t *password_callback_class,
-        axis2_char_t *authn_module_name,
-        axis2_bool_t isdigest,
+        rampart_context_t *rampart_context,
         axiom_node_t *sec_node,
         axiom_namespace_t *sec_ns_obj
                             )
@@ -178,13 +172,39 @@
     axiom_attribute_t *om_attr = NULL;
     axis2_char_t *password = NULL;
     rampart_username_token_impl_t *username_token_impl = NULL;
+    axis2_char_t *username = NULL;
+    rampart_callback_t *password_callback = NULL;
+    axis2_bool_t isdigest = AXIS2_FALSE;
+    pfunc password_function = NULL;
+    void *param = NULL;
+    
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     username_token_impl = AXIS2_INTF_TO_IMPL(username_token);
 
     /*Directly call the password from callback module*/
 
-    password = rampart_callback_password(env, password_callback_class,username);
+    username = rampart_context_get_user(rampart_context,env);
+    if(!username)
+    {
+        AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] User is not specified.");
+        return AXIS2_FAILURE;
+    }
+    password_function = rampart_context_get_password_function(rampart_context,env);
+    if(password_function)
+        password = (*password_function)(env,username,param);
+
+    else
+    {
+        password_callback = rampart_context_get_password_callback(rampart_context,env);
+        if(!password_callback)
+        {
+            AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] password callback module is not loaded. ERROR");
+            return AXIS2_FAILURE;
+        }
+
+        password = rampart_callback_password(env, password_callback,username);
+    }
 
     if (!password)
     {
@@ -221,6 +241,7 @@
         }
         /*From policy we can get this as a bool */
 /*      if (0 == AXIS2_STRCMP(password_type, RAMPART_PASSWORD_DIGEST))*/
+        isdigest = rampart_context_get_password_type(rampart_context,env);
         if(isdigest)
         {
             axis2_char_t *nonce_val = NULL;
@@ -327,14 +348,18 @@
     axis2_char_t *nonce = NULL;
     axis2_char_t *created = NULL;
     axis2_char_t *password_type = NULL;
-    axis2_char_t *pw_callback_module = NULL;
-    axis2_char_t *authn_module_name = NULL;
+    rampart_callback_t *password_callback = NULL;
+    rampart_authn_provider_t *authn_provider = NULL;
     axis2_char_t *password_from_svr = NULL;
     axis2_char_t *password_to_compare = NULL;
     axis2_ctx_t *ctx = NULL;
     rampart_username_token_impl_t *username_token_impl = NULL;
     rampart_authn_provider_status_t auth_status= RAMPART_AUTHN_PROVIDER_GENERAL_ERROR ;
     axiom_element_t *ut_ele = NULL;
+    pfunc password_function = NULL;
+    void *param = NULL;
+    auth_password_func authenticate_with_password = NULL;
+    auth_digest_func authenticate_with_digest = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     username_token_impl = AXIS2_INTF_TO_IMPL(username_token);
@@ -396,6 +421,7 @@
                     AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] Password Type is not specified in the password element");
                     return AXIS2_FAILURE;
                 }
+                /*Then we must check the password type with policy*/
                 else if(rampart_context_get_password_type(rampart_context,env))
                 {
                     if(0 != AXIS2_STRCMP(password_type, RAMPART_PASSWORD_DIGEST_URI))
@@ -461,13 +487,53 @@
      * If authentication module is defined use it. 
      * Else try the usual approach to get password from the callback and compare
      * */
+    /*In both authentication and password callback methods we should first try to
+     *use function pointers. */    
 
     /*authn_module_name = "/home/kau/axis2/c/deploy/bin/samples/rampart/authn_provider/libauthn.so";*/
-    authn_module_name = rampart_context_get_authn_module_name(rampart_context,env);
-    printf("AUTHN_MODULE_NAME =%s", authn_module_name);
-    if(authn_module_name){
-        AXIS2_LOG_INFO(env->log,  "[rampart][rampart_usernametoken] Password authentication using AUTH MODULE %s", authn_module_name);
-        auth_status = rampart_authenticate_un_pw(env, authn_module_name, username, password, nonce, created, password_type, msg_ctx);
+    if (0 == AXIS2_STRCMP(password_type, RAMPART_PASSWORD_DIGEST_URI)) 
+    {
+        authenticate_with_digest = rampart_context_get_auth_digest_function(rampart_context,env);
+        if(authenticate_with_digest)
+        {
+            auth_status = authenticate_with_digest(env,username,nonce,created,password);
+            if(RAMPART_AUTHN_PROVIDER_GRANTED == auth_status)
+            {
+                AXIS2_LOG_INFO(env->log,  "[rampart][rampart_usernametoken] User authenticated");
+                rampart_set_security_processed_result(env, msg_ctx,RAMPART_SPR_UT_CHECKED, RAMPART_YES);
+                return AXIS2_SUCCESS;
+            }
+            else
+            {
+                AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] Password is not valid for user %s : status %d", username, auth_status);
+                return AXIS2_FAILURE;
+            }
+        }
+    }   
+    else
+    {
+        authenticate_with_password = rampart_context_get_auth_password_function(rampart_context,env);
+        if(authenticate_with_password)
+        {
+            auth_status = authenticate_with_password(env,username,password);
+            if(RAMPART_AUTHN_PROVIDER_GRANTED == auth_status)
+            {
+                AXIS2_LOG_INFO(env->log,  "[rampart][rampart_usernametoken] User authenticated");
+                rampart_set_security_processed_result(env, msg_ctx,RAMPART_SPR_UT_CHECKED, RAMPART_YES);
+                return AXIS2_SUCCESS;
+            }
+            else
+            {
+                AXIS2_LOG_INFO(env->log, "[rampart][rampart_usernametoken] Password is not valid for user %s : status %d", username, auth_status);
+                return AXIS2_FAILURE;
+            }
+        }
+    }
+    authn_provider = rampart_context_get_authn_provider(rampart_context,env);
+    /*printf("AUTHN_MODULE_NAME =%s", authn_module_name);*/
+    if(authn_provider){
+        AXIS2_LOG_INFO(env->log,  "[rampart][rampart_usernametoken] Password authentication using AUTH MODULE");
+        auth_status = rampart_authenticate_un_pw(env, authn_provider, username, password, nonce, created, password_type, msg_ctx);
         if(RAMPART_AUTHN_PROVIDER_GRANTED == auth_status){
             AXIS2_LOG_INFO(env->log,  "[rampart][rampart_usernametoken] User authenticated");
             rampart_set_security_processed_result(env, msg_ctx,RAMPART_SPR_UT_CHECKED, RAMPART_YES);
@@ -479,16 +545,25 @@
         
     }else{
         /*Auth module is NULL. Use Callback password*/
-        pw_callback_module = rampart_context_get_password_callback_class(rampart_context,env);
-        if(!pw_callback_module){
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_usernametoken] Password callback module is not specified");
-            return AXIS2_FAILURE;
-        }
         
-        AXIS2_LOG_INFO(env->log,  "[rampart][rampart_usernametoken] Password authentication using CALLBACK MODULE %s", pw_callback_module);
-    
-/*      password_from_svr = rampart_callback_password(env, pw_callback_module, username, ctx);*/
-        password_from_svr = rampart_callback_password(env, pw_callback_module, username);
+        /*First we must check whether the password get function pointer is set.(eg:from php)*/
+        password_function = rampart_context_get_password_function(rampart_context,env);
+        if(password_function)
+            password_from_svr = (*password_function)(env,username,param);
+
+        else
+        {    
+            password_callback = rampart_context_get_password_callback(rampart_context,env);
+            if(!password_callback){
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_usernametoken] Password callback module is not specified");
+                return AXIS2_FAILURE;
+            }
+        
+            AXIS2_LOG_INFO(env->log,  "[rampart][rampart_usernametoken] Password authentication using CALLBACK MODULE ");
+           /*password_from_svr = rampart_callback_password(env, pw_callback_module, username, ctx);*/
+            password_from_svr = rampart_callback_password(env, password_callback, username);
+        }
+
         if (!password_from_svr)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_usernametoken] Cannot get the password for user %s", username);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org