You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by ka...@apache.org on 2007/09/27 06:25:51 UTC

svn commit: r579888 - in /webservices/rampart/trunk/c/samples: authn_provider/authn_provider.c callback/pwcb.c secpolicy/scenario2/services.xml secpolicy/scenario5/services.xml

Author: kaushalye
Date: Wed Sep 26 21:25:45 2007
New Revision: 579888

URL: http://svn.apache.org/viewvc?rev=579888&view=rev
Log:
Changes to sample scenarios 2,5
Changed authn provider sample

Modified:
    webservices/rampart/trunk/c/samples/authn_provider/authn_provider.c
    webservices/rampart/trunk/c/samples/callback/pwcb.c
    webservices/rampart/trunk/c/samples/secpolicy/scenario2/services.xml
    webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml

Modified: webservices/rampart/trunk/c/samples/authn_provider/authn_provider.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/authn_provider/authn_provider.c?rev=579888&r1=579887&r2=579888&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/authn_provider/authn_provider.c (original)
+++ webservices/rampart/trunk/c/samples/authn_provider/authn_provider.c Wed Sep 26 21:25:45 2007
@@ -27,6 +27,58 @@
 #include <axutil_string.h>
 
 axis2_char_t* AXIS2_CALL
+ramaprt_get_sample_password(const axutil_env_t *env,
+        const axis2_char_t *username)
+{
+    /*First set pf password are for sample usernames*/
+    axis2_char_t * pw = NULL;
+    if (0 == axutil_strcmp(username, "Raigama"))
+    {
+        pw = "RaigamaPW" ;
+    }
+    else if (0 == axutil_strcmp(username, "Gampola"))
+    {
+        pw = "GampolaPW";
+    }
+    else if (0 == axutil_strcmp(username, "alice"))
+    {
+        pw = "password";
+    }
+    else if (0 == axutil_strcmp(username, "Alice"))
+    {
+        pw = "abcd!1234";
+    }
+    else if (0 == axutil_strcmp(username, "bob"))
+    {
+        pw = "bobPW";
+    }
+    /*These are for sample keystores*/
+    else if (0 == axutil_strcmp(username, "a"))
+    {
+        pw = "a12345";
+    }
+    else if (0 == axutil_strcmp(username, "b"))
+    {
+        pw = "b12345";
+    }
+    else if (0 == axutil_strcmp(username, "x"))
+    {
+        pw = "x12345";
+    }
+    else if (0 == axutil_strcmp(username, "y"))
+    {
+        pw = "y12345";
+    }
+    else
+    {
+        /*Append 12345 for any name not specified above*/
+        /*sprintf(pw, "%s%s",  username, "12345");*/
+    }
+    return pw;
+};
+
+
+axis2_char_t* AXIS2_CALL
 ramaprt_get_sample_password_from_file(const axutil_env_t *env,
         const axis2_char_t *username)
 {
@@ -61,7 +113,7 @@
        AXIS2_FREE(env->allocator, pw);
        fclose ( file );
     }else{
-       AXIS2_LOG_INFO(env->log, "Cannot load the password file %s ", filename);
+       AXIS2_LOG_INFO(env->log, "[rampart][authn_provider_sample] Cannot load the password file %s ", filename);
        perror ( filename );
     }
     return password; 
@@ -76,16 +128,24 @@
                 const axis2_char_t *password)
 {
     axis2_char_t *local_pw = NULL;
-
+#ifdef PW_FROM_FILE
     local_pw = ramaprt_get_sample_password_from_file(env, username);
+    AXIS2_LOG_INFO(env->log, "[rampart][authn_provider_sample] Load the password - file impl");
+#else 
+    local_pw = ramaprt_get_sample_password(env, username);
+    AXIS2_LOG_INFO(env->log, "[rampart][authn_provider_sample] Load the password - default impl");
+#endif    
     if(local_pw){
         /*Compare passwords*/
         if(0 == axutil_strcmp(password, local_pw)){
+            AXIS2_LOG_INFO(env->log, "[rampart][authn_provider_sample] Access granted");
             return RAMPART_AUTHN_PROVIDER_GRANTED;
         }else{
+            AXIS2_LOG_INFO(env->log, "[rampart][authn_provider_sample] Access denied");
             return RAMPART_AUTHN_PROVIDER_DENIED;
         }
     }else{
+        AXIS2_LOG_INFO(env->log, "[rampart][authn_provider_sample] User not found");
         return RAMPART_AUTHN_PROVIDER_USER_NOT_FOUND;
     }
 }

Modified: webservices/rampart/trunk/c/samples/callback/pwcb.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/callback/pwcb.c?rev=579888&r1=579887&r2=579888&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/callback/pwcb.c (original)
+++ webservices/rampart/trunk/c/samples/callback/pwcb.c Wed Sep 26 21:25:45 2007
@@ -114,6 +114,7 @@
 
     if (!(*inst))
     {
+        AXIS2_LOG_INFO(env->log, "[rampart][pwcb_sample] Cannot initialize the PWCB module");
         return AXIS2_FAILURE;
     }
 

Modified: webservices/rampart/trunk/c/samples/secpolicy/scenario2/services.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/scenario2/services.xml?rev=579888&r1=579887&r2=579888&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/scenario2/services.xml (original)
+++ webservices/rampart/trunk/c/samples/secpolicy/scenario2/services.xml Wed Sep 26 21:25:45 2007
@@ -48,8 +48,8 @@
                 <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
                     <rampc:User>Bob</rampc:User>
                     <rampc:PasswordType>Digest</rampc:PasswordType>
-                    <!--rampc:AuthnModuleName>AXIS2C_HOME/bin/samples/rampart/authn_provider/libauthn.so</rampc:AuthnModuleName-->
-                    <rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+                    <rampc:AuthnModuleName>AXIS2C_HOME/bin/samples/rampart/authn_provider/libauthn.so</rampc:AuthnModuleName>
+                    <!--rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass-->
                 </rampc:RampartConfig>
             </wsp:All>
         </wsp:ExactlyOne>

Modified: webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml?rev=579888&r1=579887&r2=579888&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml (original)
+++ webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml Wed Sep 26 21:25:45 2007
@@ -71,7 +71,6 @@
                     <rampc:EncryptionUser>b</rampc:EncryptionUser>
                     <rampc:PasswordType>Digest</rampc:PasswordType>
                     <rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
-                    <!--rampc:AuthnModuleName>/AXIS2C_HOME/bin/samples/rampart/authn_provider/libauthn.so</rampc:AuthnModuleName-->
                     <rampc:ReceiverCertificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/alice_cert.cert</rampc:ReceiverCertificate>
                     <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_cert.cert</rampc:Certificate>
                     <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_key.pem</rampc:PrivateKey>