summaryrefslogtreecommitdiffstats
path: root/src/core/clientapi
diff options
context:
space:
mode:
authorGravatar damitha2011-05-31 09:16:01 +0000
committerGravatar damitha2011-05-31 09:16:01 +0000
commit0893c0b34450ccfa46463a71ad0fc588ef16abd7 (patch)
tree691cc2e3145557c028d94a4fb72cc5fcfb458b62 /src/core/clientapi
parentbcaf5833f0b73566937ad9629d01c943b553abe7 (diff)
downloadaxis2c-0893c0b34450ccfa46463a71ad0fc588ef16abd7.tar.gz
axis2c-0893c0b34450ccfa46463a71ad0fc588ef16abd7.tar.bz2
Initial checkin of ntlm auth code
git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@1129586 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/core/clientapi')
-rw-r--r--src/core/clientapi/options.c155
1 files changed, 155 insertions, 0 deletions
diff --git a/src/core/clientapi/options.c b/src/core/clientapi/options.c
index 26c5d33..28ce453 100644
--- a/src/core/clientapi/options.c
+++ b/src/core/clientapi/options.c
@@ -1063,6 +1063,161 @@ axis2_options_set_http_auth_info(
axutil_property_set_value(http_auth_property, env, axutil_strdup(env, AXIS2_VALUE_FALSE));
axis2_options_set_property(options, env, AXIS2_FORCE_HTTP_AUTH, http_auth_property);
}
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_options_set_ntlm_proxy_auth_info(
+ axis2_options_t * options,
+ const axutil_env_t * env,
+ const axis2_char_t * username,
+ const axis2_char_t * password,
+ const int * flags,
+ const axis2_char_t * domain,
+ const axis2_char_t * workstation,
+ const axis2_char_t * auth_type)
+{
+ axis2_bool_t force_proxy_auth = AXIS2_FALSE;
+ axutil_property_t *prop_pw = NULL;
+ axutil_property_t *prop_un = NULL;
+ axutil_property_t *prop_fg = NULL;
+ axutil_property_t *prop_do = NULL;
+ axutil_property_t *prop_wo = NULL;
+
+ prop_un = axutil_property_create(env);
+ axutil_property_set_value(prop_un, env, axutil_strdup(env, username));
+ axis2_options_set_property(options, env, AXIS2_PROXY_AUTH_UNAME, prop_un);
+
+ prop_pw = axutil_property_create(env);
+ axutil_property_set_value(prop_pw, env, axutil_strdup(env, password));
+ axis2_options_set_property(options, env, AXIS2_PROXY_AUTH_PASSWD, prop_pw);
+
+ if(flags)
+ {
+ axis2_char_t temp_str[4];
+ sprintf(temp_str, "%d", *flags);
+ prop_fg = axutil_property_create(env);
+ axutil_property_set_value(prop_fg, env, axutil_strdup(env, temp_str));
+ axis2_options_set_property(options, env, AXIS2_NTLM_AUTH_FLAGS, prop_fg);
+ }
+
+ if(domain)
+ {
+ prop_do = axutil_property_create(env);
+ axutil_property_set_value(prop_do, env, axutil_strdup(env, domain));
+ axis2_options_set_property(options, env, AXIS2_NTLM_AUTH_DOMAIN, prop_do);
+ }
+
+ if(workstation)
+ {
+ prop_wo = axutil_property_create(env);
+ axutil_property_set_value(prop_wo, env, axutil_strdup(env, workstation));
+ axis2_options_set_property(options, env, AXIS2_NTLM_AUTH_WORKSTATION, prop_wo);
+ }
+
+ if(auth_type)
+ {
+ if(axutil_strcasecmp(auth_type, AXIS2_HTTP_AUTH_TYPE_NTLM) == 0)
+ {
+ force_proxy_auth = AXIS2_TRUE;
+ }
+ }
+ if(force_proxy_auth)
+ {
+ axutil_property_t *proxy_auth_property = axutil_property_create(env);
+ axutil_property_t *proxy_auth_type_property = axutil_property_create(env);
+
+ axutil_property_set_value(proxy_auth_property, env, axutil_strdup(env, AXIS2_VALUE_TRUE));
+ axis2_options_set_property(options, env, AXIS2_FORCE_PROXY_AUTH, proxy_auth_property);
+
+ axutil_property_set_value(proxy_auth_type_property, env, axutil_strdup(env, auth_type));
+ axis2_options_set_property(options, env, AXIS2_PROXY_AUTH_TYPE, proxy_auth_type_property);
+ }
+ else
+ {
+ axutil_property_t *proxy_auth_property = axutil_property_create(env);
+ axutil_property_set_value(proxy_auth_property, env, axutil_strdup(env, AXIS2_VALUE_FALSE));
+ axis2_options_set_property(options, env, AXIS2_FORCE_PROXY_AUTH, proxy_auth_property);
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_options_set_ntlm_http_auth_info(
+ axis2_options_t * options,
+ const axutil_env_t * env,
+ const axis2_char_t * username,
+ const axis2_char_t * password,
+ const int * flags,
+ const axis2_char_t * domain,
+ const axis2_char_t * workstation,
+ const axis2_char_t * auth_type)
+{
+ axis2_bool_t force_http_auth = AXIS2_FALSE;
+ axutil_property_t *prop_un = NULL;
+ axutil_property_t *prop_pw = NULL;
+ axutil_property_t *prop_fg = NULL;
+ axutil_property_t *prop_do = NULL;
+ axutil_property_t *prop_wo = NULL;
+
+ prop_un = axutil_property_create(env);
+ axutil_property_set_value(prop_un, env, axutil_strdup(env, username));
+ axis2_options_set_property(options, env, AXIS2_HTTP_AUTH_UNAME, prop_un);
+
+ prop_pw = axutil_property_create(env);
+ axutil_property_set_value(prop_pw, env, axutil_strdup(env, password));
+ axis2_options_set_property(options, env, AXIS2_HTTP_AUTH_PASSWD, prop_pw);
+
+ if(flags)
+ {
+ axis2_char_t temp_str[4];
+ sprintf(temp_str, "%d", *flags);
+ prop_fg = axutil_property_create(env);
+ axutil_property_set_value(prop_fg, env, axutil_strdup(env, temp_str));
+ axis2_options_set_property(options, env, AXIS2_NTLM_AUTH_FLAGS, prop_fg);
+ }
+
+ if(domain)
+ {
+ prop_do = axutil_property_create(env);
+ axutil_property_set_value(prop_do, env, axutil_strdup(env, domain));
+ axis2_options_set_property(options, env, AXIS2_NTLM_AUTH_DOMAIN, prop_do);
+ }
+
+ if(workstation)
+ {
+ prop_wo = axutil_property_create(env);
+ axutil_property_set_value(prop_wo, env, axutil_strdup(env, workstation));
+ axis2_options_set_property(options, env, AXIS2_NTLM_AUTH_WORKSTATION, prop_wo);
+ }
+
+
+ if(auth_type)
+ {
+ if(axutil_strcasecmp(auth_type, AXIS2_HTTP_AUTH_TYPE_NTLM) == 0)
+ {
+ force_http_auth = AXIS2_TRUE;
+ }
+ }
+ if(force_http_auth)
+ {
+ axutil_property_t *http_auth_property = axutil_property_create(env);
+ axutil_property_t *http_auth_type_property = axutil_property_create(env);
+
+ axutil_property_set_value(http_auth_property, env, axutil_strdup(env, AXIS2_VALUE_TRUE));
+ axis2_options_set_property(options, env, AXIS2_FORCE_HTTP_AUTH, http_auth_property);
+
+ axutil_property_set_value(http_auth_type_property, env, axutil_strdup(env, auth_type));
+ axis2_options_set_property(options, env, AXIS2_HTTP_AUTH_TYPE, http_auth_type_property);
+ }
+ else
+ {
+ axutil_property_t *http_auth_property = axutil_property_create(env);
+ axutil_property_set_value(http_auth_property, env, axutil_strdup(env, AXIS2_VALUE_FALSE));
+ axis2_options_set_property(options, env, AXIS2_FORCE_HTTP_AUTH, http_auth_property);
+ }
+
return AXIS2_SUCCESS;
}