Author: shankar
Date: Wed Jun 11 10:49:32 2008
New Revision: 666749
URL: http://svn.apache.org/viewvc?rev=666749&view=rev
Log:
formatting and removing unwanted codes.
Modified:
webservices/rampart/trunk/c/include/rampart_authn_provider.h
webservices/rampart/trunk/c/include/rampart_callback.h
webservices/rampart/trunk/c/include/rampart_credentials.h
webservices/rampart/trunk/c/include/rampart_replay_detector.h
webservices/rampart/trunk/c/include/rampart_util.h
webservices/rampart/trunk/c/samples/secpolicy/run_all.bat
webservices/rampart/trunk/c/src/trust/sts_client.c
webservices/rampart/trunk/c/src/util/rampart_engine.c
webservices/rampart/trunk/c/src/util/rampart_replay_detector.c
webservices/rampart/trunk/c/src/util/rampart_username_token.c
webservices/rampart/trunk/c/src/util/rampart_util.c
Modified: webservices/rampart/trunk/c/include/rampart_authn_provider.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_authn_provider.h?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_authn_provider.h (original)
+++ webservices/rampart/trunk/c/include/rampart_authn_provider.h Wed Jun 11
10:49:32 2008
@@ -20,9 +20,9 @@
#define RAMPART_AUTHN_PROVIDER_H
/**
- * @file rampart_authn_provider.h
- * @brief The authentication interface of rampart. Validates a username and
password pair.
- */
+* @file rampart_authn_provider.h
+* @brief The authentication interface of rampart. Validates a username and
password pair.
+*/
/**
* @defgroup rampart_authn_provider Authentication Provider
@@ -39,7 +39,8 @@
extern "C"
{
#endif
- enum rampart_authn_provider_status{
+ enum rampart_authn_provider_status
+ {
RAMPART_AUTHN_PROVIDER_DENIED = 0,
RAMPART_AUTHN_PROVIDER_GRANTED,
RAMPART_AUTHN_PROVIDER_FOUND,
@@ -55,25 +56,14 @@
* @{
*/
- /**
- * Type name for struct rampart_authn_provider_ops
- */
typedef struct rampart_authn_provider_ops rampart_authn_provider_ops_t;
-
- /**
- * Type name for struct rampart_authn_provider
- */
-
typedef struct rampart_authn_provider rampart_authn_provider_t;
- /**
- */
struct rampart_authn_provider_ops
{
-
-
/**
- * Check plain text passwords. If the UseranmeToken is in plain text
this function will be called.
+ * Check plain text passwords. If the UseranmeToken is in plain text
+ * this function will be called.
* @param authn_provider the authentication provider struct
* @param env pointer to environment struct
* @param msg_ctx message context
@@ -82,45 +72,45 @@
* @return the status of the check
*/
rampart_authn_provider_status_t (AXIS2_CALL*
-
rampart_authn_provider_check_password)(
- rampart_authn_provider_t
*authn_provider,
- const axutil_env_t* env,
- axis2_msg_ctx_t *msg_ctx,
- const axis2_char_t *username,
- const axis2_char_t *password
- );
+ rampart_authn_provider_check_password)(
+ rampart_authn_provider_t *authn_provider,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t *msg_ctx,
+ const axis2_char_t *username,
+ const axis2_char_t *password);
/**
- * Check digested passwords. If the UseranmeToken is in password
digest form this function will be called.
+ * Check digested passwords. If the UseranmeToken is in password
digest form
+ * this function will be called.
* @param authn_provider the authentication provider struct
* @param env pointer to environment struct
* @param msg_ctx message context
* @param username the username
- * @param nonce the noce or the random value of the username token
+ * @param nonce the nonce or the random value of the username token
* @param created the created value of the username token
* @param digest the digest value of the SHA-1(password+created+nonce)
* @return the status of the check
*/
rampart_authn_provider_status_t (AXIS2_CALL*
-
rampart_authn_provider_check_password_digest)(
- rampart_authn_provider_t
*authn_provider,
- const axutil_env_t* env,
- axis2_msg_ctx_t *msg_ctx,
- const axis2_char_t *username,
- const axis2_char_t *nonce,
- const axis2_char_t *created,
- const char *digest
- );
+ rampart_authn_provider_check_password_digest)(
+ rampart_authn_provider_t *authn_provider,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t *msg_ctx,
+ const axis2_char_t *username,
+ const axis2_char_t *nonce,
+ const axis2_char_t *created,
+ const char *digest);
/**
* The free function to free all resources allocated
* @param authn_provider the authentication provider struct
* @param env pointer to environment struct
- *
+ * @return AXIS2_SUCCESS on success. AXIS2_FAILURE otherwise.
*/
axis2_status_t (AXIS2_CALL*
- free)(rampart_authn_provider_t *authn_provider,
- const axutil_env_t* env);
+ free)(
+ rampart_authn_provider_t *authn_provider,
+ const axutil_env_t* env);
};
@@ -131,20 +121,21 @@
};
/*************************** Function macros
**********************************/
- /*TODO write the implementation*/
#define RAMPART_AUTHN_PROVIDER_FREE(authn_provider, env) \
((authn_provider)->ops->free (authn_provider, env))
#define RAMPART_AUTHN_PROVIDER_CHECK_PASSWORD(authn_provider, env, msg_ctx,
username, password) \
-
((authn_provider)->ops->rampart_authn_provider_check_password(authn_provider,
env, msg_ctx, username, password))
+ ((authn_provider)->ops->rampart_authn_provider_check_password( \
+ authn_provider, env, msg_ctx, username, password))
#define RAMPART_AUTHN_PROVIDER_CHECK_PASSWORD_DIGEST(authn_provider, env,
msg_ctx, username, nonce, nonce_length, digest) \
-
((authn_provider)->ops->rampart_authn_provider_check_password_digest(authn_provider,
env, msg_ctx, username, nonce, nonce_length, digest))
+ ((authn_provider)->ops->rampart_authn_provider_check_password_digest( \
+ authn_provider, env, msg_ctx, username, nonce, nonce_length,
digest))
/** @} */
#ifdef __cplusplus
}
#endif
-#endif /* RAMPART_AUTHN_PROVIDER_H */
+#endif /* RAMPART_AUTHN_PROVIDER_H */
Modified: webservices/rampart/trunk/c/include/rampart_callback.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_callback.h?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_callback.h (original)
+++ webservices/rampart/trunk/c/include/rampart_callback.h Wed Jun 11 10:49:32
2008
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include <axutil_utils_defines.h>
#include <axis2_defines.h>
#include <axutil_param.h>
@@ -21,9 +22,9 @@
#define RAMPART_CALLBACK_H
/**
- * @file rampart_callback.h
- * @brief The callback module for a password
- */
+* @file rampart_callback.h
+* @brief The callback module for a password
+*/
#ifdef __cplusplus
@@ -37,21 +38,9 @@
* @{
*/
- /**
- * Type name for struct rampart_callback_ops
- */
typedef struct rampart_callback_ops rampart_callback_ops_t;
-
- /**
- * Type name for struct rampart_callback
- */
-
typedef struct rampart_callback rampart_callback_t;
- /**
- * Only operation get_password is to get the password
- * User should provide a function pointer to this
- */
struct rampart_callback_ops
{
/**
@@ -118,5 +107,5 @@
}
#endif
-#endif /* RAMPART_CALLBACK_H */
+#endif /* RAMPART_CALLBACK_H */
Modified: webservices/rampart/trunk/c/include/rampart_credentials.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_credentials.h?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_credentials.h (original)
+++ webservices/rampart/trunk/c/include/rampart_credentials.h Wed Jun 11
10:49:32 2008
@@ -25,9 +25,10 @@
#include <axis2_msg_ctx.h>
#include <axutil_param.h>
/**
- * @file rampart_credentials.h
- * @brief The credentials interface for rampart. To retrieve a username and
password pair.
- */
+* @file rampart_credentials.h
+* @brief The credentials interface for rampart. To retrieve a username and
password pair.
+*/
+
/**
* @defgroup rampart_credentials Credentials Provider
* @{
@@ -37,7 +38,8 @@
extern "C"
{
#endif
- enum rampart_credentials_status{
+ enum rampart_credentials_status
+ {
RAMPART_CREDENTIALS_PW_FOUND = 0,
RAMPART_CREDENTIALS_PW_NOT_FOUND,
RAMPART_CREDENTIALS_USER_FOUND,
@@ -51,19 +53,9 @@
* Struct to get username/password pair
*/
- /**
- * Type name for struct rampart_credentials_ops
- */
typedef struct rampart_credentials_ops rampart_credentials_ops_t;
-
- /**
- * Type name for struct rampart_credentials
- */
-
typedef struct rampart_credentials rampart_credentials_t;
- /**
- */
struct rampart_credentials_ops
{
@@ -77,13 +69,13 @@
* @return The status of extracting credentials
*/
rampart_credentials_status_t (AXIS2_CALL*
- rampart_credentials_username_get)(
- rampart_credentials_t *credentials,
- const axutil_env_t* env,
- axis2_msg_ctx_t *msg_ctx,
- axis2_char_t **username,
- axis2_char_t **password
- );
+ rampart_credentials_username_get)(
+ rampart_credentials_t *credentials,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t *msg_ctx,
+ axis2_char_t **username,
+ axis2_char_t **password);
+
/**
* The free function for the credentials
* @param credentials pointer to the credentials struct
@@ -91,8 +83,9 @@
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
axis2_status_t (AXIS2_CALL*
- free)(rampart_credentials_t *credentials,
- const axutil_env_t* env);
+ free)(
+ rampart_credentials_t *credentials,
+ const axutil_env_t* env);
};
@@ -107,7 +100,8 @@
((credentials)->ops->free (credentials, env))
#define RAMPART_CREDENTIALS_USERNAME_GET(credentials, env, msg_ctx, username,
password) \
- ((credentials)->ops->rampart_credentials_username_get(credentials, env,
msg_ctx, username, password))
+ ((credentials)->ops->rampart_credentials_username_get( \
+ credentials, env, msg_ctx, username, password))
@@ -116,5 +110,5 @@
}
#endif
-#endif /* RAMPART_CREDENTIALS_H */
+#endif /* RAMPART_CREDENTIALS_H */
Modified: webservices/rampart/trunk/c/include/rampart_replay_detector.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_replay_detector.h?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_replay_detector.h (original)
+++ webservices/rampart/trunk/c/include/rampart_replay_detector.h Wed Jun 11
10:49:32 2008
@@ -19,9 +19,9 @@
#define RAMPART_REPLAY_DETECTOR_H
/**
- * @file rampart_replay_detector.h
- * @brief The replay_detector module for rampart
- */
+* @file rampart_replay_detector.h
+* @brief The replay_detector module for rampart
+*/
/**
* @defgroup rampart_replay_detector Replay Detector
@@ -39,34 +39,37 @@
{
#endif
-
- /**
- * Type name for struct rampart_replay_detector_ops
- */
typedef struct rampart_replay_detector_ops rampart_replay_detector_ops_t;
-
- /**
- * Type name for struct rampart_replay_detector
- */
-
typedef struct rampart_replay_detector rampart_replay_detector_t;
- /**
- * Only operation get_password is to get the password
- * User should provide a function pointer to this
- */
struct rampart_replay_detector_ops
{
+ /**
+ * Check whether the message is replayed or not. If not replayed,
message fields have to be
+ * stored to check replay status of future messages
+ * @param rrd the replay detector struct
+ * @param env pointer to environment struct
+ * @param msg_ctx message context
+ * @param rampart_context rampart context struct
+ * @return the status of the check
+ */
axis2_status_t (AXIS2_CALL*
- is_replayed)(rampart_replay_detector_t *rrd,
- const axutil_env_t* env,
- axis2_msg_ctx_t *msg_ctx,
-
rampart_context_t *rampart_context);
+ is_replayed)(
+ rampart_replay_detector_t *rrd,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t *msg_ctx,
+ rampart_context_t *rampart_context);
+ /**
+ * The free function to free all resources allocated
+ * @param rrd the replay detector structure
+ * @param env pointer to environment struct
+ * @return AXIS2_SUCCESS on success. AXIS2_FAILURE otherwise.
+ */
axis2_status_t (AXIS2_CALL*
- free)(rampart_replay_detector_t *rrd,
- const axutil_env_t* env);
-
+ free)(
+ rampart_replay_detector_t *rrd,
+ const axutil_env_t* env);
};
struct rampart_replay_detector
@@ -75,91 +78,44 @@
axutil_param_t *param;
};
-
- /**
- * The default impl for RRD
- * @param env pointer to environment struct,Must not be NULL.
- * @param msg_ctx
- * @param rampart_context
- * @returns status of the op.
- * AXIS2_SUCCESS on success and AXIS2_FAILURE on error
- */
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- rampart_replay_detector_default(const axutil_env_t *env,
- axis2_msg_ctx_t *msg_ctx,
- rampart_context_t *rampart_context);
- /**
- *
- * @param env pointer to environment struct,Must not be NULL.
- * @param ctx
- * @returns status of the op.
- * AXIS2_SUCCESS on success and AXIS2_FAILURE on error
- */
-
- AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
- rampart_replay_detector_set_default_db(const axutil_env_t *env,
- axis2_ctx_t *ctx);
+
/**
* A linked list based implementation for RRD
* This doesnt required addressing headers to be present
* @param env pointer to environment struct,Must not be NULL.
- * @param msg_ctx
- * @param rampart_context
- * @returns status of the op.
- * AXIS2_SUCCESS on success and AXIS2_FAILURE on error
+ * @param msg_ctx message context structure
+ * @param rampart_context rampart context structure
+ * @returns status of the op. AXIS2_SUCCESS on success and AXIS2_FAILURE
on error
*/
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
- rampart_replay_detector_with_linked_list(const axutil_env_t *env,
- axis2_msg_ctx_t* msg_ctx,
- rampart_context_t *rampart_context);
+ rampart_replay_detector_with_linked_list(
+ const axutil_env_t *env,
+ axis2_msg_ctx_t* msg_ctx,
+ rampart_context_t *rampart_context);
+
/**
- *
- * @param env pointer to environment struct,Must not be NULL.
- * @param ctx
- * @returns status of the op.
- * AXIS2_SUCCESS on success and AXIS2_FAILURE on error
- */
-
- AXIS2_EXTERN axutil_linked_list_t *AXIS2_CALL
- rampart_replay_detector_set_ll_db(const axutil_env_t *env,
- axis2_ctx_t *ctx);
- /**
- *
+ * @param linked_list linked list structure where messages/fields are
stored
* @param env pointer to environment struct,Must not be NULL.
* @param msg_ctx
* @returns status of the op.
* AXIS2_SUCCESS on success and AXIS2_FAILURE on error
*/
-
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- rampart_replay_detector_final_cleanup(const axutil_env_t *env,
- axis2_msg_ctx_t* msg_ctx);
- /**
- *
- * @param linked_list
- * @param env pointer to environment struct,Must not be NULL.
- * @param id
- * @returns status of the op.
- * AXIS2_SUCCESS on success and AXIS2_FAILURE on error
- */
-
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
- rampart_replay_detector_linked_list_contains(axutil_linked_list_t
*linked_list,
-
const axutil_env_t *env,
-
axis2_char_t *id);
+ rampart_replay_detector_linked_list_contains(
+ axutil_linked_list_t *linked_list,
+ const axutil_env_t *env,
+ axis2_char_t *id);
+
/**
- *
* @param env pointer to environment struct,Must not be NULL.
* @param msg_ctx
* @returns status of the op.
* AXIS2_SUCCESS on success and AXIS2_FAILURE on error
*/
-
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
- rampart_replay_detector_get_ts(const axutil_env_t *env,
-
axis2_msg_ctx_t* msg_ctx);
+ rampart_replay_detector_get_ts(
+ const axutil_env_t *env,
+ axis2_msg_ctx_t* msg_ctx);
/*************************** Function macros
**********************************/
#define RAMPART_REPLAY_DETECTOR_IS_REPLAYED(replay_detector, env, msg_ctx,
rampart_context) \
@@ -173,5 +129,5 @@
}
#endif
-#endif /* RAMPART_REPLAY_DETECTOR_H */
+#endif /* RAMPART_REPLAY_DETECTOR_H */
Modified: webservices/rampart/trunk/c/include/rampart_util.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_util.h?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_util.h (original)
+++ webservices/rampart/trunk/c/include/rampart_util.h Wed Jun 11 10:49:32 2008
@@ -1,21 +1,20 @@
/*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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 <axutil_utils_defines.h>
#include <axis2_defines.h>
#include <axutil_date_time.h>
@@ -27,16 +26,18 @@
#include <rampart_callback.h>
#include <rampart_replay_detector.h>
#include <rampart_sct_provider.h>
+
/**
- * @file rampart_util.h
- * @brief Utilities of rampart
- */
+* @file rampart_util.h
+* @brief Utilities of rampart
+*/
/**
* @defgroup rampart_util Utils
* @ingroup rampart_utils
* @{
*/
+
#ifndef RAMPART_UTIL_H
#define RAMPART_UTIL_H
@@ -44,20 +45,6 @@
extern "C" {
#endif
-
-
- /**
- * Load a DLL or .SO module
- * User MUST free memory
- * @param env pointer to environment struct
- * @param module_name name of the module to be loaded
- * @return the loaded module
- */
- AXIS2_EXTERN void* AXIS2_CALL
- rampart_load_module(const axutil_env_t *env,
- axis2_char_t *module_name,
- axutil_param_t **param);
-
/**
* Load the credentials module
* User MUST free memory
@@ -66,12 +53,13 @@
* @return the loaded credentails module
*/
AXIS2_EXTERN rampart_credentials_t* AXIS2_CALL
- rampart_load_credentials_module(const axutil_env_t *env,
- axis2_char_t *cred_module_name);
+ rampart_load_credentials_module(
+ const axutil_env_t *env,
+ axis2_char_t *cred_module_name);
/**
* Call credentials module
- * User MUST free memory
+ * User MUST free memory of username and password
* @param env pointer to environment struct
* @param cred_module the credentails module
* @param ctx the message context
@@ -80,22 +68,24 @@
* @return the status of the operation
*/
AXIS2_EXTERN rampart_credentials_status_t AXIS2_CALL
- rampart_call_credentials(const axutil_env_t *env,
- rampart_credentials_t *cred_module,
- axis2_msg_ctx_t *ctx,
- axis2_char_t **username,
- axis2_char_t **password);
+ rampart_call_credentials(
+ const axutil_env_t *env,
+ rampart_credentials_t *cred_module,
+ axis2_msg_ctx_t *ctx,
+ axis2_char_t **username,
+ axis2_char_t **password);
/**
* Load authentication module
* User MUST free memory
* @param env pointer to environment struct
* @param auth_module_name name of the authentication module
- * @return creatd athenticaiton module
+ * @return created athenticaiton module
*/
AXIS2_EXTERN rampart_authn_provider_t* AXIS2_CALL
- rampart_load_auth_module(const axutil_env_t *env,
- axis2_char_t *auth_module_name);
+ rampart_load_auth_module(
+ const axutil_env_t *env,
+ axis2_char_t *auth_module_name);
/**
* Load replay detection module
@@ -105,8 +95,9 @@
* @return created replay detection module
*/
AXIS2_EXTERN rampart_replay_detector_t* AXIS2_CALL
- rampart_load_replay_detector(const axutil_env_t *env,
- axis2_char_t *replay_detector_name);
+ rampart_load_replay_detector(
+ const axutil_env_t *env,
+ axis2_char_t *replay_detector_name);
/**
* Load security context token provider
@@ -116,8 +107,22 @@
* @return created security context token provider module
*/
AXIS2_EXTERN rampart_sct_provider_t* AXIS2_CALL
- rampart_load_sct_provider(const axutil_env_t *env,
- axis2_char_t *sct_provider_name);
+ rampart_load_sct_provider(
+ const axutil_env_t *env,
+ axis2_char_t *sct_provider_name);
+
+ /**
+ * Load the password callback module
+ * User MUST free memory
+ * @param env pointer to environment struct
+ * @callback_module_name the name of the callback module
+ * @return the loaded callback module
+ */
+ AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
+ rampart_load_pwcb_module(
+ const axutil_env_t *env,
+ axis2_char_t *callback_module_name);
+
/**
* Call auth module
@@ -125,43 +130,36 @@
* @param authp the authentication module
* @param username the username in the UsernameToken
* @param password the password in the UsernameToken
- * @param nonce the nonce in the UsernameToken
- * @param created the created time in the UsernameToken
+ * @param nonce the nonce in the UsernameToken. Can be NULL if plain text
password is used.
+ * @param created created time in UsernameToken. Can be NULL if plain
text password is used.
* @param password_type the type of the password. either plain text of
digest
* @param msg_ctx the message context
+ * @return status of the operation
*/
AXIS2_EXTERN rampart_authn_provider_status_t AXIS2_CALL
- rampart_authenticate_un_pw(const axutil_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_authenticate_un_pw(
+ const axutil_env_t *env,
+ rampart_authn_provider_t *authp,
+ const axis2_char_t *username,
+ const axis2_char_t *password,
+ const axis2_char_t *nonce,
+ const axis2_char_t *created,
+ const axis2_char_t *password_type,
+ axis2_msg_ctx_t *msg_ctx);
- /**
- * Load the password callback module
- * User MUST free memory
- * @param env pointer to environment struct
- * @callback_module_name the name of the callback module
- * @return the loaded callback module
- */
- AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
- rampart_load_pwcb_module(const axutil_env_t *env,
- axis2_char_t *callback_module_name);
/**
- [EMAIL PROTECTED] the environment
- [EMAIL PROTECTED] the file name of the callback module (.so or .DLL)
- [EMAIL PROTECTED] the name of the user to get the password
- [EMAIL PROTECTED] The axis2 context
- [EMAIL PROTECTED] the password for the user or NULL if failed
- */
+ * Gets the password of given user.
+ * @env the environment
+ * @callback_module callback module structure
+ * @username the name of the user to get the password
+ * @return the password for the user or NULL if failed
+ */
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
- rampart_callback_password(const axutil_env_t *env,
- rampart_callback_t *callback_module,
- const axis2_char_t *username);
+ rampart_callback_password(
+ const axutil_env_t *env,
+ rampart_callback_t *callback_module,
+ const axis2_char_t *username);
/**
* Get the password for pkcs12 key store.
@@ -172,52 +170,43 @@
*/
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
rampart_callback_pkcs12_password(
- const axutil_env_t *env,
- rampart_callback_t *callback_module,
- const axis2_char_t *username);
+ const axutil_env_t *env,
+ rampart_callback_t *callback_module,
+ const axis2_char_t *username);
/**
- * Generates the nonce. Nonce is a base64 encoded random string.
- * User MUST free memory
- * @param env pointer to environment struct
- * @return generated nonce
- */
- AXIS2_EXTERN axis2_char_t *AXIS2_CALL
- rampart_generate_nonce(const axutil_env_t *env, int length);
-
- /**
- * Generates the nonce. Nonce is a base64 encoded random string.
+ * Generates time.
* User MUST free memory
* @param ttl Time to live. The time difference between created and
expired in mili seconds.
- * @return generated nonce
+ * @return generated time
**/
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
- rampart_generate_time(const axutil_env_t *env, int ttl);
+ rampart_generate_time(
+ const axutil_env_t *env,
+ int ttl);
/**
* Check if @dt1 < @dt2. if not returns a false
* @param env pointer to environment struct
* @param dt1 date time 1
* @param dt2 date time 2
+ * @return AXIS2_SUCCESS if dt1 < dt2. AXIS2_FALSE otherwise
*/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
- rampart_compare_date_time(const axutil_env_t *env, axis2_char_t *dt1,
axis2_char_t *dt2);
-
- /**
- * Print or log information (Only use for debugging)
- * @param env pointer to environment struct
- * @param info the information to be printed
- */
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- rampart_print_info(const axutil_env_t *env, axis2_char_t* info);
+ rampart_compare_date_time(
+ const axutil_env_t *env,
+ axis2_char_t *dt1,
+ axis2_char_t *dt2);
/**
* check whether different keys are needed for encryption and signature
* @param env pointer to environment struct
* @param rampart_context rampart context
+ * @return AXIS2_TRUE if different keys are needed. AXIS2_FALSE otherwise.
*/
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
- is_different_session_key_for_encryption_and_signing(const axutil_env_t
*env,
+ is_different_session_key_for_encryption_and_signing(
+ const axutil_env_t *env,
rampart_context_t *rampart_context);
/* @} */
@@ -225,6 +214,6 @@
}
#endif
-#endif /* !RAMPART_UTIL_H */
+#endif /* RAMPART_UTIL_H */
Modified: webservices/rampart/trunk/c/samples/secpolicy/run_all.bat
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/run_all.bat?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/run_all.bat (original)
+++ webservices/rampart/trunk/c/samples/secpolicy/run_all.bat Wed Jun 11
10:49:32 2008
@@ -7,7 +7,7 @@
-for %%i in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) do call
test_scen.bat %_SCEN%%%i %_PORT% off
+for %%i in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23) do call
test_scen.bat %_SCEN%%%i %_PORT% off
taskkill /F /IM axis2_http_server.exe
echo DONE
Modified: webservices/rampart/trunk/c/src/trust/sts_client.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/trust/sts_client.c?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/trust/sts_client.c (original)
+++ webservices/rampart/trunk/c/src/trust/sts_client.c Wed Jun 11 10:49:32 2008
@@ -18,6 +18,7 @@
#include <trust_sts_client.h>
#include <axis2_op_client.h>
#include <openssl_hmac.h>
+#include <oxs_utility.h>
static void
trust_sts_client_insert_entropy(
@@ -550,7 +551,7 @@
}
/*nonce should be created with half the size. size is in bits, have to
convert it to bytes*/
- nonce = rampart_generate_nonce(env, key_size/16);
+ nonce = oxs_util_generate_nonce(env, key_size/16);
if(!nonce)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] cannon create nonce
with length %d", key_size/16);
Modified: webservices/rampart/trunk/c/src/util/rampart_engine.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_engine.c?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Wed Jun 11 10:49:32
2008
@@ -322,7 +322,7 @@
* this function will be used*/
if(is_inflow)
{
- rampart_context_set_replay_detect_function(rampart_context, env,
rampart_replay_detector_with_linked_list/*rampart_replay_detector_default*/);
+ rampart_context_set_replay_detect_function(rampart_context, env,
rampart_replay_detector_with_linked_list);
}
}
return rampart_context;
Modified: webservices/rampart/trunk/c/src/util/rampart_replay_detector.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_replay_detector.c?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_replay_detector.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_replay_detector.c Wed Jun 11
10:49:32 2008
@@ -24,6 +24,31 @@
#include <rampart_sec_processed_result.h>
#include <rampart_util.h>
+
+/**
+ *
+ * @param env pointer to environment struct,Must not be NULL.
+ * @param ctx
+ * @returns status of the op.
+ * AXIS2_SUCCESS on success and AXIS2_FAILURE on error
+ */
+
+ AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
+ rampart_replay_detector_set_default_db(const axutil_env_t *env,
+ axis2_ctx_t *ctx);
+
+ /**
+ *
+ * @param env pointer to environment struct,Must not be NULL.
+ * @param ctx
+ * @returns status of the op.
+ * AXIS2_SUCCESS on success and AXIS2_FAILURE on error
+ */
+
+ AXIS2_EXTERN axutil_linked_list_t *AXIS2_CALL
+ rampart_replay_detector_set_ll_db(const axutil_env_t *env,
+ axis2_ctx_t *ctx);
+
/*Private functions*/
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
rampart_replay_detector_linked_list_contains(axutil_linked_list_t *linked_list,
@@ -232,26 +257,6 @@
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_replay_detector_final_cleanup(const axutil_env_t *env,
- axis2_msg_ctx_t* msg_ctx)
-{
- axutil_linked_list_t *ll = NULL;
- int count = 0;
- int i = 0;
-
- ll = rampart_replay_detector_get_ll_db(env, msg_ctx);
- count = axutil_linked_list_size(ll, env);
- for(i=0; i<count; i++){
- axis2_char_t *tmp_id = NULL;
-
- tmp_id = (axis2_char_t*)axutil_linked_list_get(ll, env, i);
- AXIS2_FREE(env->allocator, tmp_id);
- }
- axutil_linked_list_free(ll, env);
- return AXIS2_SUCCESS;
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_replay_detector_with_linked_list(const axutil_env_t *env,
axis2_msg_ctx_t* msg_ctx,
rampart_context_t *rampart_context)
@@ -344,85 +349,3 @@
}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_replay_detector_default(const axutil_env_t *env,
- axis2_msg_ctx_t* msg_ctx,
- rampart_context_t *rampart_context)
-{
- axutil_hash_t *hash = NULL;
- axutil_hash_index_t *hi = NULL;
- const axis2_char_t *msg_id = NULL;
- const axis2_char_t *ts = NULL;
- int valid_duration = RAMPART_RD_DEF_VALID_DURATION;
-
- msg_id = axis2_msg_ctx_get_wsa_message_id(msg_ctx, env);
- if(!msg_id){
- msg_id = "MSG-ID";/*This has to be changed to generate the hash*/
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] NO msg_id
specified, using default = %s", msg_id);
- }
- ts = rampart_replay_detector_get_ts( env, msg_ctx);
- /*Get the DB*/
- hash = rampart_replay_detector_get_default_db(env, msg_ctx);
- if(!hash){
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rrd] Cannot get the
default database for replay detection from msg_ctx");
- return AXIS2_FAILURE;
- }else{
-
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Number of
records =%d", axutil_hash_count(hash));
-
- /*Get the valid duration for a record*/
- if(rampart_context_get_rd_val(rampart_context, env)){
- valid_duration =
axutil_atoi(rampart_context_get_rd_val(rampart_context, env));
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Using the
specified valid duration %d\n", valid_duration );
- }else{
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Using the
default valid duration %d\n", valid_duration );
- }
-
- /*If the table already have the same key it's a replay*/
- if(AXIS2_TRUE == axutil_hash_contains_key(hash, env, msg_id)){
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rrd] For ID=%s,
a replay detected", msg_id);
- return AXIS2_FAILURE;
- }
-
- /*Iterate thru records*/
- /*printf("Iterate--------------------=%d\n",
axutil_hash_count(hash));*/
- for (hi = axutil_hash_first(hash, env); hi; hi = axutil_hash_next(env,
hi)) {
- axis2_char_t *id = NULL; /*Temp record id (of i'th recored)*/
- axis2_char_t *tmp_ts = NULL; /*Temp time stamp (of i'th recored))*/
-
- axutil_hash_this(hi, (void*)&id, NULL, (void*)&tmp_ts);
- /*tmp_ts = (axis2_char_t*)val;*/
- if(!id){
- /*printf("[rampart][rrd] ID is NULL. Cont loop\n");*/
- continue;
- }
- /*printf("[rampart][rrd] (id = tmp_ts) %s = %s\n",
(axis2_char_t*)id, (axis2_char_t*)tmp_ts);*/
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] (id,
tmp_ts) %s = %s\n", (axis2_char_t*)id, (axis2_char_t*)tmp_ts);
-
- /*Clean up old records*/
-
- if(AXIS2_TRUE == rampart_replay_detector_is_overdue(env ,
-valid_duration, tmp_ts)){ /*TODO*/
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd]
Removing old record (id, tmp_ts) = (%s , %s)\n",
- (axis2_char_t*)id, (axis2_char_t*)tmp_ts);
- /*printf("Deleting record... , (id = tmp_ts) %s = %s\n", id,
tmp_ts);*/
- axutil_hash_set(hash, id, AXIS2_HASH_KEY_STRING, NULL);
- if(id){
- AXIS2_FREE(env->allocator, id);
- id = NULL;
- }
- if(tmp_ts){
- AXIS2_FREE(env->allocator, tmp_ts);
- tmp_ts = NULL;
- }
- }
- }/*eof for loop*/
- /*If not replayed then we will insert the new record to the DB*/
- /*NOTE: We do a strdup here, 'coz we dont need these values to be lost
once the msg cycle is over.*/
- /*printf("Adding record... , (id = ts) %s = %s\n", msg_id, ts);*/
- axutil_hash_set(hash, axutil_strdup(env, msg_id),
AXIS2_HASH_KEY_STRING, axutil_strdup(env, ts));
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Adding record
key=%s to the DB", msg_id);
- return AXIS2_SUCCESS;
- }
-}
-
Modified: webservices/rampart/trunk/c/src/util/rampart_username_token.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_username_token.c?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_username_token.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_username_token.c Wed Jun 11
10:49:32 2008
@@ -31,6 +31,7 @@
#include <rampart_sec_processed_result.h>
#include <rampart_authn_provider.h>
#include <oxs_axiom.h>
+#include <oxs_utility.h>
/** public functions*/
@@ -144,7 +145,7 @@
axis2_char_t *created_val = NULL;
axis2_char_t *digest_val = NULL;
- nonce_val = rampart_generate_nonce(env, 24) ;
+ nonce_val = oxs_util_generate_nonce(env, 24) ;
created_val = rampart_generate_time(env, 0);
digest_val = rampart_crypto_sha1(env, nonce_val, created_val,
password);
Modified: webservices/rampart/trunk/c/src/util/rampart_util.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_util.c?rev=666749&r1=666748&r2=666749&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_util.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_util.c Wed Jun 11 10:49:32 2008
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-/*
- *
- */
+
#include <stdio.h>
#include <rampart_util.h>
#include <axis2_util.h>
@@ -34,93 +32,96 @@
#include <oxs_utility.h>
#include <rampart_context.h>
-/*Calculate the hash of concatenated string of
- * nonce, created and the password.
- *
- */
-#define SIZE 256
-#define SIZE_HASH 32
-#define SIZE_NONCE 24
-
-
-/*#define PRINTINFO 1 */
-
-AXIS2_EXTERN void* AXIS2_CALL
-rampart_load_module(const axutil_env_t *env,
- axis2_char_t *module_name,
- axutil_param_t **param)
+/* Load a .dll or .so module */
+static void*
+rampart_load_module(
+ const axutil_env_t *env,
+ axis2_char_t *module_name,
+ axutil_param_t **param)
{
axutil_dll_desc_t *dll_desc = NULL;
axutil_param_t *impl_info_param = NULL;
void *ptr = NULL;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rampart_util] Trying to
load module = %s", module_name);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Trying to load module %s", module_name);
dll_desc = axutil_dll_desc_create(env);
axutil_dll_desc_set_name(dll_desc, env, module_name);
impl_info_param = axutil_param_create(env, NULL, dll_desc);
- /*Set the free function*/
axutil_param_set_value_free(impl_info_param, env,
axutil_dll_desc_free_void_arg);
axutil_class_loader_init(env);
ptr = axutil_class_loader_create_dll(env, impl_info_param);
- *param = impl_info_param;
-
if (!ptr)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_util]
Unable to load the module %s. ERROR", module_name);
- return NULL;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Unable to load the module %s.",
module_name);
+ axutil_param_free(impl_info_param, env);
+ }
+ else
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Successfully loaded module %s",
module_name);
+ *param = impl_info_param;
}
return ptr;
}
-AXIS2_EXTERN rampart_credentials_status_t AXIS2_CALL
-rampart_call_credentials(const axutil_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 axutil_env_t *env,
- axis2_char_t *cred_module_name)
+rampart_load_credentials_module(
+ const axutil_env_t *env,
+ axis2_char_t *cred_module_name)
{
rampart_credentials_t *cred = NULL;
axutil_param_t *param = NULL;
cred = (rampart_credentials_t*)rampart_load_module(env, cred_module_name,
¶m);
- if (!cred)
+ if(!cred)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_util]
Unable to identify the credentials module %s. ERROR", cred_module_name);
- return AXIS2_FAILURE;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Unable to identify the credentials
module %s.",
+ cred_module_name);
}
- if(param){
+ else if(param)
+ {
cred->param = param;
}
return cred;
}
+AXIS2_EXTERN rampart_credentials_status_t AXIS2_CALL
+rampart_call_credentials(
+ const axutil_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_authn_provider_t* AXIS2_CALL
-rampart_load_auth_module(const axutil_env_t *env,
- axis2_char_t *auth_module_name)
+rampart_load_auth_module(
+ const axutil_env_t *env,
+ axis2_char_t *auth_module_name)
{
rampart_authn_provider_t *authp = NULL;
axutil_param_t *param = NULL;
authp = (rampart_authn_provider_t*)rampart_load_module(env,
auth_module_name, ¶m);
- if (!authp)
+ if(!authp)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_util]
Unable to identify the authentication module %s. ERROR", auth_module_name);
- return AXIS2_FAILURE;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Unable to identify the authentication
module %s.",
+ auth_module_name);
}
- if(param){
+ else if(param)
+ {
authp->param = param;
}
@@ -128,19 +129,22 @@
}
AXIS2_EXTERN rampart_replay_detector_t* AXIS2_CALL
-rampart_load_replay_detector(const axutil_env_t *env,
- axis2_char_t *replay_detector_name)
+rampart_load_replay_detector(
+ const axutil_env_t *env,
+ axis2_char_t *replay_detector_name)
{
rampart_replay_detector_t *rd = NULL;
axutil_param_t *param = NULL;
rd = (rampart_replay_detector_t*)rampart_load_module(env,
replay_detector_name, ¶m);
- if (!rd)
+ if(!rd)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_util]
Unable to identify the replay detection module %s. ERROR",
replay_detector_name);
- return AXIS2_FAILURE;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Unable to identify the replay detection
module %s.",
+ replay_detector_name);
}
- if(param){
+ else if(param)
+ {
rd->param = param;
}
@@ -148,19 +152,21 @@
}
AXIS2_EXTERN rampart_sct_provider_t* AXIS2_CALL
-rampart_load_sct_provider(const axutil_env_t *env,
- axis2_char_t *sct_provider_name)
+rampart_load_sct_provider(
+ const axutil_env_t *env,
+ axis2_char_t *sct_provider_name)
{
rampart_sct_provider_t *sct_provider = NULL;
axutil_param_t *param = NULL;
sct_provider = (rampart_sct_provider_t*)rampart_load_module(env,
sct_provider_name, ¶m);
- if (!sct_provider)
+ if(!sct_provider)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_util]
Unable to identify the security context token provider module %s. ERROR",
sct_provider_name);
- return AXIS2_FAILURE;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Unable to identify security context token
provider module %s.",
+ sct_provider_name);
}
- if(param)
+ else if(param)
{
sct_provider->param = param;
}
@@ -169,68 +175,74 @@
}
AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
-rampart_load_pwcb_module(const axutil_env_t *env,
- axis2_char_t *callback_module_name)
+rampart_load_pwcb_module(
+ const axutil_env_t *env,
+ axis2_char_t *callback_module_name)
{
rampart_callback_t *cb = NULL;
axutil_param_t *param = NULL;
cb = (rampart_callback_t*)rampart_load_module(env, callback_module_name,
¶m);
- if (!cb)
+ if(!cb)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rampart_util]
Unable to identify the callback module %s. ERROR", callback_module_name);
- if (param)
- {
- axutil_param_free(param, env);
- param = NULL;
- }
- return AXIS2_FAILURE;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Unable to identify the callback module
%s.",
+ callback_module_name);
}
- if(param){
+ else if(param)
+ {
cb->param = param;
}
- return cb;
+ return cb;
}
AXIS2_EXTERN rampart_authn_provider_status_t AXIS2_CALL
-rampart_authenticate_un_pw(const axutil_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_authenticate_un_pw(
+ const axutil_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)
+ if(authp)
{
- return RAMPART_AUTHN_PROVIDER_GENERAL_ERROR;
+ if(0 == axutil_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);
+ }
}
- /*If password digest*/
- if(0 == axutil_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);
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_util] Cannot authenticate user. Authentication
module is not valid");
}
return auth_status;
}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-rampart_callback_password(const axutil_env_t *env,
- rampart_callback_t *callback_module,
- const axis2_char_t *username)
+rampart_callback_password(
+ const axutil_env_t *env,
+ rampart_callback_t *callback_module,
+ const axis2_char_t *username)
{
axis2_char_t *password = NULL;
void *cb_prop_val= NULL;
/*Get the password thru the callback*/
password = RAMPART_CALLBACK_CALLBACK_PASSWORD(callback_module, env,
username, cb_prop_val);
-
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rampart_util] Password
taken from the callback module . SUCCESS");
return password;
}
@@ -245,20 +257,14 @@
/*Get the password through the callback module*/
password = RAMPART_CALLBACK_CALLBACK_PKCS12_PASSWORD(callback_module,
env, username, cb_prop_val);
-
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][ramaprt_util]
Password taken from the callback module. SUCCESS");
return password;
}
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-rampart_generate_nonce(const axutil_env_t *env, int length)
-{
- return oxs_util_generate_nonce(env, length);
-}
-
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-rampart_generate_time(const axutil_env_t *env, int ttl)
+rampart_generate_time(
+ const axutil_env_t *env,
+ int ttl)
{
axutil_date_time_t *dt = NULL;
axis2_char_t *dt_str = NULL;
@@ -271,27 +277,25 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_compare_date_time(const axutil_env_t *env, axis2_char_t *dt1_str,
axis2_char_t *dt2_str)
+rampart_compare_date_time(
+ const axutil_env_t *env,
+ axis2_char_t *dt1_str,
+ axis2_char_t *dt2_str)
{
axis2_status_t status = AXIS2_FAILURE;
axutil_date_time_t *dt1 = NULL;
axutil_date_time_t *dt2 = NULL;
axutil_date_time_comp_result_t res = AXIS2_DATE_TIME_COMP_RES_UNKNOWN;
-#if 0
- int yyyy1, mm1, dd1, hh1, mi1, ss1, ml1;
- int yyyy2, mm2, dd2, hh2, mi2, ss2, ml2;
-#endif
- dt1 = axutil_date_time_create(env);
- dt2 = axutil_date_time_create(env);
+ dt1 = axutil_date_time_create(env);
status = axutil_date_time_deserialize_date_time(dt1, env, dt1_str);
- if (status == AXIS2_FAILURE)
+ if (!status)
{
axutil_date_time_free(dt1, env);
- axutil_date_time_free(dt2, env);
return AXIS2_FAILURE;
}
+ dt2 = axutil_date_time_create(env);
status = axutil_date_time_deserialize_date_time(dt2, env, dt2_str);
if (status == AXIS2_FAILURE)
{
@@ -304,48 +308,49 @@
res = axutil_date_time_compare(dt1, env, dt2);
axutil_date_time_free(dt1, env);
axutil_date_time_free(dt2, env);
- if(AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED == res){
+ if(AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED == res)
+ {
return AXIS2_SUCCESS;
- }else{
+ }
+ else
+ {
return AXIS2_FAILURE;
}
-
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_print_info(const axutil_env_t *env, axis2_char_t* info)
-{
-#ifdef PRINTINFO
- printf("[rampart]: %s\n", info);
-#endif
- return AXIS2_SUCCESS;
}
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-is_different_session_key_for_encryption_and_signing(const axutil_env_t *env,
- rampart_context_t
*rampart_context)
+is_different_session_key_for_encryption_and_signing(
+ const axutil_env_t *env,
+ rampart_context_t *rampart_context)
{
rp_property_t *binding = NULL;
- binding =
rp_secpolicy_get_binding(rampart_context_get_secpolicy(rampart_context,
env),env);
- if(binding)
+ axis2_bool_t use_different_key = AXIS2_FALSE;
+
+ if(rampart_context)
{
- if(rp_property_get_type(binding,env) == RP_PROPERTY_SYMMETRIC_BINDING)
+ binding =
rp_secpolicy_get_binding(rampart_context_get_secpolicy(rampart_context,
env),env);
+ if(binding)
{
- rp_symmetric_binding_t *sym_binding = NULL;
- rp_property_t *token = NULL;
- sym_binding = (rp_symmetric_binding_t
*)rp_property_get_value(binding,env);
- if(sym_binding)
+ if(rp_property_get_type(binding,env) ==
RP_PROPERTY_SYMMETRIC_BINDING)
{
- /*check protection tokens have being specified. If not, use
the different session key for
- encryption and signature */
- token =
rp_symmetric_binding_get_protection_token(sym_binding,env);
- if(!token)
- return AXIS2_TRUE;
+ rp_symmetric_binding_t *sym_binding = NULL;
+ rp_property_t *token = NULL;
+ sym_binding = (rp_symmetric_binding_t
*)rp_property_get_value(binding,env);
+ if(sym_binding)
+ {
+ /* check protection tokens have being specified. If not
(means encryption token
+ and signature token is specified), use different
session key for
+ encryption and signature
+ */
+ token =
rp_symmetric_binding_get_protection_token(sym_binding,env);
+ if(!token)
+ use_different_key = AXIS2_TRUE;
+ }
}
}
}
- return AXIS2_FALSE;
+ return use_different_key;
}