Skip to content
Permalink
Browse files
Commiting the code attached in AXIS2C-168. Thanks Kaushalye
  • Loading branch information
Damitha N.M. Kumarage committed Jun 13, 2006
1 parent bab706a commit d8f0c3c5fdf5bf8754e5654d0fd6290b9bc9772b
Showing 33 changed files with 2,430 additions and 10 deletions.
38 INSTALL
@@ -7,8 +7,42 @@ This can be done using the following command sequence:
make install
use './configure --help' for options

NOTE: If you don't provide a --prefix configure option, it will by default
install into /usr/local/axis2_util directory.
Engage rampart with axis2/C
==================================
Steps:

Configuring server:
-----------------------------------
1. Run build.sh in axis2/c/rampart directory
2. Copy rampart directory created in rampart/target to AXIS2C_HOME/deploy/modules
3. To engage rampart add to axis.xml
<module ref="rampart"/>

4. To set inflow security parameters add following to global configuration file or service configuration file
<parameter name="InflowSecurity">
<action>
<items>UsernameToken</items>
<passwordCallbackClass>/your/module/to/load/passwordcallback.so</passwordCallbackClass>
</action>
</parameter>

Configure client:
-----------------------------------
1. To set outflow security parameters add following to global configuration file or service configuration file
<parameter name="OutflowSecurity">
<action>
<items>UsernameToken</items>
<user>MyName</user>
<passwordType>passwordDigest</passwordType>
<passwordCallbackClass>/your/module/to/load/passwordcallback.so</passwordCallbackClass>
</action>
</parameter>

Writing callback modules:
-----------------------------------
User can specify which .so module to use to callback the password.
For this user must provide a function pointer for get_password() operation in rampart_callback_t
See rampart/samples/callback/pwcb.c for clarity



@@ -1,2 +1,2 @@
SUBDIRS = src
SUBDIRS = src test samples

1 NEWS
@@ -0,0 +1 @@
AWAIT : Timestamp token
@@ -118,7 +118,15 @@ AC_SUBST(XMLSCHEMAINC)

AC_CONFIG_FILES([Makefile \
src/Makefile \
src/handlers/Makefile
src/handlers/Makefile \
src/core/Makefile\
src/util/Makefile\
test/Makefile \
test/util/Makefile\
samples/Makefile \
samples/callback/Makefile \
samples/client/Makefile \
samples/client/echo/Makefile
])

AC_OUTPUT
@@ -0,0 +1,62 @@
/*
* 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_CALLBACK_H
#define RAMPART_CALLBACK_H


#ifdef __cplusplus
extern "C"
{
#endif

/**
* Struct to get password using callbacks
* @defgroup rampart_callback rampart callback
* @ingroup rampart_util
* @{
*/

/** 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 prvide a function pointer to this
*/
AXIS2_DECLARE_DATA struct rampart_callback_ops
{
axis2_char_t *(AXIS2_CALL*
get_password)(rampart_callback_t *rcb,
const axis2_env_t *env, const axis2_char_t *username);

};

AXIS2_DECLARE_DATA struct rampart_callback
{
rampart_callback_ops_t *ops;
};

/** @} */
#ifdef __cplusplus
}
#endif

#endif /* RAMPART_CALLBACK_H */

@@ -0,0 +1,65 @@
/*
* 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_CONSTANTS_H
#define RAMPART_CONSTANTS_H

#ifdef __cplusplus
extern "C"
{
#endif

/* rampart element names*/
#define RAMPART_SECURITY "Security"
#define RAMPART_SECURITY_USERNAMETOKEN "UsernameToken"
#define RAMPART_SECURITY_USERNAMETOKEN_USERNAME "Username"
#define RAMPART_SECURITY_USERNAMETOKEN_PASSWORD "Password"
#define RAMPART_SECURITY_USERNAMETOKEN_CREATED "Created"
#define RAMPART_SECURITY_USERNAMETOKEN_NONCE "Nonce"
#define RAMPART_SECURITY_USERNAMETOKEN_PASSWORD_ATTR_TYPE "Type"
#define RAMPART_SECURITY_TIMESTAMP "Timestamp"
#define RAMPART_SECURITY_TIMESTAMP_CREATED "Created"
#define RAMPART_SECURITY_TIMESTAMP_EXPIRES "Expires"

/*Rampart URIs*/
#define RAMPART_WSSE "wsse"
#define RAMPART_WSSE_XMLNS "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
#define RAMPART_WSU "wsu"
#define RAMPART_WSU_XMLNS "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
#define RAMPART_PASSWORD_DIGEST_URI "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"

/* Inflow outflow security parameter */
#define RAMPART_INFLOW_SECURITY "InflowSecurity"
#define RAMPART_OUTFLOW_SECURITY "OutflowSecurity"
#define RAMPART_ACTION "action"
#define RAMPART_ACTION_ITEMS "items"
#define RAMPART_USER "user"
#define RAMPART_PASSWORD_TYPE "passwordType"
#define RAMPART_PASSWORD_TEXT "passwordText"
#define RAMPART_PASSWORD_DIGEST "passwordDigest"
#define RAMPART_ACTION_ITEMS_USERNAMETOKEN "UsernameToken"
#define RAMPART_ACTION_ITEMS_TIMESTAMP "Timestamp"
#define RAMPART_ACTION_PW_CALLBACK_CLASS "passwordCallbackClass"

/*Dynamically set values*/
#define RAMPART_DYN_PASSWORD "password"

#ifdef __cplusplus
}
#endif

#endif /* RAMPART_CONSTANTS_H*/
@@ -0,0 +1,59 @@
/*
* Copyright 2003-2004 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.
*/

#include<openssl/sha.h>

#include <axis2_utils_defines.h>
#include <axis2_defines.h>
#include <axis2_env.h>

/**
* @file rampart_crypto_util.h
* @brief RAMPART-UTIL Crypto
*/
#ifndef RAMPART_CRYPTO_UTIL
#define RAMPART_CRYPTO_UTIL

#ifdef __cplusplus
extern "C" {
#endif

/**
* @defgroup Rampart_Crypto_Util
* @ingroup Rampart_Util
*/


/**
* Calculate the hash of concatenated string of followings
* @param nonce
* @param created
* @param password
* @return calculated hash
*/
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
rampart_crypto_sha1(const axis2_env_t *env,
const axis2_char_t *nonce,
const axis2_char_t *created,
const axis2_char_t *password);


/* @} */
#ifdef __cplusplus
}
#endif

#endif /* !RAMPART_CRYPTO_H */
@@ -0,0 +1,117 @@
/**
* 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.
*/


#include <axis2_handler_desc.h>
#include <axis2_array_list.h>
#include <axiom_soap_const.h>
#include <axiom_soap_envelope.h>
#include <axiom_soap_header.h>
#include <axiom_soap_header_block.h>
#include <axis2_op.h>
#include <axis2_msg_ctx.h>
#include <axis2_msg_info_headers.h>
#include <axis2_property.h>
#include <rampart/rampart_constants.h>



#ifndef RAMPART_HANDLER_UTIL_H
#define RAMPART_HANDLER_UTIL_H


#ifdef __cplusplus
extern "C"
{
#endif


/**
* Get parameter for the given parameter name
* @param env pointer to environment struct
* @param msg_ctx message context
* @param parameter the parameter name
* @return parameter
*/

AXIS2_EXTERN axis2_param_t* AXIS2_CALL
rampart_get_security_param( const axis2_env_t *env,
const axis2_msg_ctx_t *msg_ctx,
const axis2_char_t *parameter);

/**
* Get actions specified in In/OutflowSecurity
* @param env pointer to environment struct
* @param ctx context
* @param Outflowsecurity
* @return parameters in an array list
*/
AXIS2_EXTERN axis2_array_list_t* AXIS2_CALL
rampart_get_actions( const axis2_env_t *env,
const axis2_ctx_t *ctx,
const axis2_param_t *param_x_flow_security);




/**
* Get the value of the action parameter given the key name
* Here the key name means the name of the subelement of the
* action element.
* @param env pointer to environment struct
* @param ctx context
* @param param_action action parameter
* @param key element name as a string
* @return the value of the element
*/

AXIS2_EXTERN axis2_char_t* AXIS2_CALL
rampart_get_action_params( const axis2_env_t *env,
const axis2_ctx_t *ctx,
const axis2_param_t *param_action,
const axis2_char_t *key);


/**
* Get the security token from the header block
* @param env pointer to environment struct
* @param msg_ctx message context
* @param soap heamsg_ctxder
* @return soap_header security element node
*/
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
rampart_get_security_token(const axis2_env_t *env,
const axis2_msg_ctx_t *msg_ctx,
axiom_soap_header_t *soap_header);

/**
* Get password using callback
* @param env pointer to environment struct
* @return password
*/

AXIS2_EXTERN axis2_char_t* AXIS2_CALL
rampart_callback_pw( const axis2_env_t *env,
const axis2_char_t *callback_module_name,
const axis2_char_t *username);

/** @} */
#ifdef __cplusplus
}
#endif


#endif /*RAMPART_HANDLER_UTIL_H*/

0 comments on commit d8f0c3c

Please sign in to comment.