# saml_req.h

    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 #ifndef SAML_REQ_H
    00019 #define SAML_REQ_H
    00020
    00021 #include <saml.h>
    00022 #include <oxs_xml_signature.h>
    00023 #include <oxs_sign_ctx.h>
    00024 #include <oxs_xml_key_processor.h>
    00025 #include <oxs_utility.h>
    00026 #include <oxs_transforms_factory.h>
    00027 #include <oxs_xml_key_info_builder.h>
    00028 #include <oxs_key_mgr.h>
    00029 #include <oxs_transform.h>
    00030 #include <oxs_x509_cert.h>
    00031
    00032 #ifdef __cplusplus
    00033 extern "C"
    00034 {
    00035 #endif
    00036
    00037 #define SAML_REQUEST_ID        "RequestID"
    00038 #define SAML_SIGNATURE        "Signature"
    00039 #define SAML_SUBJECT_QUERY    "SubjectQuery"
    00040 #define SAML_ATTRIBUTE_QUERY  "AttributeQuery"
    00041 #define SAML_AUTHENTICATION_QUERY    "AuthenticationQuery"
    00042 #define SAML_AUTHORIZATION_DECISION_QUERY    "AuthorizationDecisionQuery"
    00043 #define SAML_ASSERTION_ID_REF        "AssertionIDReference"
    00044 #define SAML_ASSERTION_ARTIFACT    "AssertionArtifact"
    00045 #define SAML_RESPOND_WITH            "RespondWith"
    00046 #define SAML_ATTRIBUTE_DESIGNATOR        "AttributeDesignator"
    00047 #define SAML_RESPONSE_ID            "ResponceID"
    00048 #define SAML_IN_RESPONSE_TO        "InResponseTo"
    00049 #define SAML_RECEPIENT            "Recipient"
    00050 #define SAML_STATUS_CODE            "StatusCode"
    00051 #define SAML_STATUS_MESSAGE            "StatusMessage"
    00052 #define SAML_STATUS_DETAIL        "StatusDetail"
    00053 #define SAML_STATUS_VALUE        "Value"
    00054 #define SAML_STATUS                "Status"
    00055 #define SAML_PROTOCOL_NMSP                      "urn:oasis:names:tc:SAML:1.0:protocol"
    00056 #define SAML_PROTOCOL_PREFIX            "samlp"
    00057 #define SAML_REQUEST                            "Request"
    00058 #define SAML_RESPONSE                           "Response"
    00059
    00060 /*A code representing the status of the corresponding request*/
    00061
    00062 /*
    00063  * saml artifact for saml passive client assertion identifiers
    00064  */
    00065 typedef struct saml_artifact
    00066 {
    00067         axis2_char_t *artifact;
    00068 }saml_artifact_t;
    00069
    00070 /*
    00071  * saml status : defines the status returned in saml response
    00072  */
    00073 typedef struct saml_status
    00074 {
    00075     axutil_qname_t *status_value;
    00076     axis2_char_t *status_code;
    00077     axis2_char_t *status_msg;
    00078     axiom_node_t *status_detail;
    00079
    00080 }saml_status_t;
    00081
    00082 /*
    00083  * the saml query for requesting required saml assertion
    00084  */
    00085 typedef struct saml_query
    00086 {
    00087         axis2_char_t *type;
    00088         void *query;
    00089 }saml_query_t;
    00090
    00091 typedef struct saml_subject_query
    00092 {
    00093     saml_subject_t *subject;
    00094 }saml_subject_query_t;
    00095
    00096 /*
    00097  * saml authentication query : for requesting authentication details
    00098  */
    00099 typedef struct saml_authentication_query
    00100 {
    00101     saml_subject_t *subject;
    00102     /* A URI reference that specifies the type of authentication that took place */
    00103     axis2_char_t *auth_method;
    00104
    00105 }saml_authentication_query_t;
    00106
    00107 /*
    00108  * saml qttribute query : for requesting the attributes
    00109  */
    00110 typedef struct saml_attr_query
    00111 {
    00112     saml_subject_t *subject;
    00113     axis2_char_t *resource;
    00114     axutil_array_list_t *attr_desigs;
    00115 }saml_attr_query_t;
    00116
    00117 /*
    00118  * saml authorization decision query : for requesting information for asserting authorization decisions
    00119  */
    00120 typedef struct saml_autho_decision_query
    00121 {
    00122     saml_subject_t *subject;
    00123     axis2_char_t *resource;
    00124     /* One or more saml actions*/
    00125     axutil_array_list_t *saml_actions;
    00126     saml_evidence_t *evidence;
    00127
    00128 }saml_autho_decision_query_t;
    00129
    00130 typedef struct saml_request
    00131 {
    00132         /* unique request id*/
    00133     axis2_char_t *request_id;
    00134
    00135     /* major version */
    00136     axis2_char_t *major_version;
    00137
    00138     /* minor version */
    00139     axis2_char_t *minor_version;
    00140
    00141     /* time instant of the issue */
    00142     axutil_date_time_t *issue_instant;
    00143
    00144     /*optional*/
    00145     oxs_sign_ctx_t *sig_ctx;
    00146
    00147     /* An array for QNames
    00148          * specifies the type of statement the SAML relying party wants from the
    00149          * SAML authority*
    00150          */
    00151     axutil_array_list_t *saml_responds;
    00152
    00153     /*To request assrtions by means of ID one or more*/
    00154     axutil_array_list_t *saml_asserion_id_ref;
    00155
    00156         /* saml artifacts for saml passive client*/
    00157     axutil_array_list_t *saml_artifacts;
    00158
    00159         saml_query_t *query;
    00160
    00161         /*reference to the saml request node*/
    00162         axiom_node_t *original_xml;
    00163
    00164         /*reference to the saml response node*/
    00165         axiom_node_t *signature;
    00166 }saml_request_t;
    00167
    00168 typedef struct saml_response
    00169 {
    00170         /*sunique saml response id*/
    00171     axis2_char_t *response_id;
    00172
    00173         /*major version*/
    00174     axis2_char_t *major_version;
    00175
    00176         /*minor version*/
    00177     axis2_char_t *minor_version;
    00178
    00179     /*saml request party*/
    00180     axis2_char_t *recepient;
    00181
    00182         /*saml request identifier for the specific saml response*/
    00183     axis2_char_t  *request_response_id;
    00184
    00185         /*time instant for the respone*/
    00186     axutil_date_time_t *issue_instant;
    00187
    00188         /* information about the signing */
    00189     oxs_sign_ctx_t *sig_ctx;
    00190
    00191     saml_status_t *status;
    00192
    00193     axutil_array_list_t *saml_assertions;
    00194
    00195         /* reference to the saml response node*/
    00196         axiom_node_t *original_xml;
    00197
    00198         /*reference to the saml signature node*/
    00199         axiom_node_t *signature;
    00200 }saml_response_t;
    00201
    00202 /* request */
    00203
    00204 /*
    00205  *  Creates a saml request.
    00206  *  @param env pointer to environment struct
    00207  */
    00208 AXIS2_EXTERN saml_request_t *AXIS2_CALL
    00209 saml_request_create(const axutil_env_t *env);
    00210
    00211 /*
    00212  * Free a saml request
    00213  * @param env pointer to environment struct
    00214  */
    00215 AXIS2_EXTERN void AXIS2_CALL
    00216 saml_request_free(saml_request_t *request, const axutil_env_t *env);
    00217
    00218 /*
    00219 * Build the saml request from a axiom node.
    00220 * @param request request to be populated
    00221 * @param env pointer to environment struct
    00222 */
    00223 AXIS2_EXTERN int AXIS2_CALL
    00224 saml_request_build(saml_request_t *request, axiom_node_t *node,
    00225                                    const axutil_env_t *env);
    00226
    00227 /*
    00228 * Serialize a saml request to a om node.
    00229 * @param request request to be serialized
    00230 * @param parent if specified created node will be a child of this
    00231 * @param env pointer to environment struct
    00232 */
    00233 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
    00234 saml_request_to_om(saml_request_t *request, axiom_node_t *parent,
    00235                                    const axutil_env_t *env);
    00236 /*
    00237 * Return the unique ID of the request.
    00238 * @param request SAML Request object
    00239 * @param env pointer to environment struct
    00240 */
    00241 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
    00242 saml_request_get_id(saml_request_t *request, const axutil_env_t *env);
    00243
    00244 /*
    00245  * Set the information required to sign the message.
    00246  * @param assertion SAML Request object
    00247  * @param env pointer to environment struct
    00248  * @param sign_ctx oxs_sign_ctx_t object which contains the sign information
    00249  */
    00250 AXIS2_EXTERN int AXIS2_CALL
    00251 saml_request_set_signature(saml_request_t *request, const axutil_env_t *env,
    00252                                                    oxs_sign_ctx_t *sig_ctx);
    00253 /*
    00254  * Set the default information required to sign the message.
    00255  * @param response SAML response object
    00256  * @param env pointer to environment struct
    00257  * @param sign_ctx oxs_sign_ctx_t object which contains the sign information
    00258  * oxs_sign_ctx should contain the key info and the certification info.
    00259  * all other information are set to default settings.
    00260  */
    00261 AXIS2_EXTERN void AXIS2_CALL
    00262 saml_request_set_default_signature(saml_request_t *request, const axutil_env_t *env,
    00263                                                                    oxs_sign_ctx_t *sig_ctx);
    00264 /*
    00265  * Remove the information set for signing or verifying the Request.
    00266  * @param assertion SAML Request object
    00267  * @param env pointer to environment struct
    00268  */
    00269 AXIS2_EXTERN int AXIS2_CALL
    00270 saml_request_unsign(saml_request_t *request, const axutil_env_t *env);
    00271
    00272 /*
    00273  * Sign the Request using the information set in the
    00274  * saml_request_set_default_signature or saml_request_set_signature method.
    00275  * @param assertion SAML Request object
    00276  * @param env pointer to environment struct
    00277  */
    00278 AXIS2_EXTERN int AXIS2_CALL
    00279 saml_request_sign(saml_request_t *request, axiom_node_t *node, const axutil_env_t *env);
    00280
    00281 /*
    00282  * Set the minor version of the Request
    00283  * @param request SAML Request object
    00284  * @param env pointer to environment struct
    00285  * @param version minor version number
    00286  */
    00287 AXIS2_EXTERN int AXIS2_CALL
    00288 saml_request_set_minor_version(saml_request_t *request, const axutil_env_t *env,
    00289                                                            int version);
    00290 /*
    00291  * Set the major version of the assertion
    00292  * @param assertion SAML Request object
    00293  * @param env pointer to environment struct
    00294  * @param version major version number
    00295  */
    00296 AXIS2_EXTERN int AXIS2_CALL
    00297 saml_request_set_major_version(saml_request_t *request,
    00298                                                            const axutil_env_t *env, int version);
    00299 /*
    00300  * Set the issue instant of the Request
    00301  * @param request SAML Request object
    00302  * @param env pointer to environment struct
    00303  * @param time time instant of the saml issue
    00304  */
    00305 AXIS2_EXTERN int AXIS2_CALL
    00306 saml_request_set_issue_instant(saml_request_t *request,
    00307                                                            const axutil_env_t *env, axutil_date_time_t *date_time);
    00308
    00309 /*
    00310  * Return the time instant of the Request
    00311  * @param request SAML Request object
    00312  * @param env pointer to the environment struct
    00313  */
    00314 AXIS2_EXTERN axutil_date_time_t* AXIS2_CALL
    00315 saml_request_get_issue_instant(saml_request_t *request, const  axutil_env_t *env);
    00316
    00317 /*
    00318  * Set the set of qname respond with references in Request
    00319  * @param request SAML Request object
    00320  * @param responds list of qname objects
    00321  * @param env pointer to the environment struct
    00322  */
    00323 AXIS2_EXTERN int AXIS2_CALL
    00324 saml_request_set_respond_withs(saml_request_t *request,
    00325                                                            const axutil_env_t *env, axutil_array_list_t *responds);
    00326
    00327 /*
    00328  * Return the set of qname respond with references in Request
    00329  * @param request SAML Request object
    00330  * @param env pointer to the environment struct
    00331  */
    00332 AXIS2_EXTERN axutil_array_list_t* AXIS2_CALL
    00333 saml_request_get_respond_withs(saml_request_t *request, const axutil_env_t *env);
    00334
    00335 /*
    00336  * Add a qname object respond with to the Request
    00337  * @param request SAML Request object
    00338  * @param env pointer to the environment struct
    00339  */
    00340 AXIS2_EXTERN int AXIS2_CALL
    00341 saml_request_add_respond_with(saml_request_t *request, const axutil_env_t *env,
    00342                                                           axutil_qname_t *respond);
    00343 /*
    00344  * Remove a qname object at the specified index
    00345  * @param request SAML Request object
    00346  * @index the specific index to remove
    00347  * @param env pointer to the environment struct
    00348  */
    00349 AXIS2_EXTERN int AXIS2_CALL
    00350 saml_request_remove_respond_with(saml_request_t *request, const axutil_env_t *env, int index);
    00351
    00352 /*
    00353  * Set the SAML Query of SAML Request.
    00354  * @param request SAML Request object
    00355  * @param query SAML Query object
    00356  * @param env pointer to the environment struct
    00357  */
    00358 AXIS2_EXTERN int AXIS2_CALL
    00359 saml_request_set_query(saml_request_t *request, const axutil_env_t *env, saml_query_t *query);
    00360
    00361 /*
    00362  * Returns the SAML Query of SAML Request.
    00363  * @param request SAML Request
    00364  * @param env pointer to the environemt struct
    00365  */
    00366 AXIS2_EXTERN saml_query_t* AXIS2_CALL
    00367 saml_request_get_query(saml_request_t *request, const axutil_env_t *env);
    00368
    00369 /*
    00370  * Set the set of Identifer References of the Request.
    00371  * @param request SAML Request
    00372  * @param id_refs list of Identifier references
    00373  * @param env pointer to the environment struct
    00374  */
    00375 AXIS2_EXTERN int AXIS2_CALL
    00376 saml_request_set_id_refs(saml_request_t *request, const axutil_env_t *env,
    00377                                                  axutil_array_list_t *id_refs);
    00378 /*
    00379  * Returne the list of Identifier references of the Request
    00380  * @param request SAML Request
    00381  * @param env pointer to the environment struct
    00382  */
    00383 AXIS2_EXTERN axutil_array_list_t* AXIS2_CALL
    00384 saml_request_get_id_refs(saml_request_t *request, const axutil_env_t *env);
    00385
    00386 /*
    00387  * Add an Id Reference to the SAML Request.
    00388  * @param request SAML Request
    00389  * @param id_references list of Id references
    00390  * @param env pointer to the environment struct
    00391  */
    00392 AXIS2_EXTERN int AXIS2_CALL
    00393 saml_request_add_id_refs(saml_request_t *request, const axutil_env_t *env,
    00394                                                  axis2_char_t *id_reference);
    00395 /*
    00396  * Remove an Id Reference at the specified index.
    00397  * @param request SAML Request
    00398  * @param index the specific to remove
    00399  * @param env pointer to the environment struct
    00400  */
    00401 AXIS2_EXTERN int AXIS2_CALL
    00402 saml_request_remove_id_refs(saml_request_t *request,
    00403                                                         const axutil_env_t *env, int index);
    00404 /*
    00405  * Set the set of SAML Assertion Artifact objects of the Request.
    00406  * @param request SAML Request
    00407  * @param artifacts list of SAML Artifact objects
    00408  * @param env pointer to the environment struct
    00409  */
    00410 AXIS2_EXTERN int AXIS2_CALL
    00411 saml_request_set_artifacts(saml_request_t *request,
    00412                                                    const axutil_env_t *env, axutil_array_list_t *artifacts);
    00413 /*
    00414  * Returns the list of SAML Assertion Artifacts of the Request
    00415  * @param request SAML Request
    00416  * @param env pointer to the environment struct
    00417  */
    00418 AXIS2_EXTERN axutil_array_list_t*  AXIS2_CALL
    00419 saml_request_get_artifacts(saml_request_t *request, const axutil_env_t *env);
    00420
    00421 /*
    00422  * Add a SAML Assertion Artifact to the Request
    00423  * @param request SAML Request
    00424  * @param artifact SAML Assertion Artifact
    00425  * @param env pointer to the environment struct
    00426  */
    00427 AXIS2_EXTERN int AXIS2_CALL
    00428 saml_request_add_artifact(saml_request_t *request, const axutil_env_t *env,
    00429                                                   saml_artifact_t *artifact);
    00430 /*
    00431  * Remove a SAML Assertion Artifact at the specified index
    00432  * @param request SAML Request
    00433  * @param index specific index to remove
    00434  * @param env pointer to the environment struct
    00435  */
    00436 AXIS2_EXTERN int AXIS2_CALL
    00437 saml_request_remove_artifact(saml_request_t *request, const axutil_env_t *env,
    00438                                                          int index);
    00439 /*
    00440  * Check the validity of the recieved Request
    00441  * @param request SAML Request
    00442  * @param env pointer to the environment struct
    00443  */
    00444 AXIS2_EXTERN axis2_bool_t AXIS2_CALL
    00445 saml_request_check_validity(saml_request_t *request, const axutil_env_t *env);
    00446
    00447 /*
    00448  *  Creates a saml Response.
    00449  *  @param env pointer to environment struct
    00450  */
    00451 AXIS2_EXTERN saml_response_t* saml_response_create(const axutil_env_t *env);
    00452
    00453 /*
    00454  * Free a saml Response
    00455  * @param env pointer to environment struct
    00456  */
    00457 AXIS2_EXTERN void saml_response_free(saml_response_t *response,
    00458                                                                          const axutil_env_t *env);
    00459 /*
    00460 * Build the saml response from a axiom node.
    00461 * @param request response to be populated
    00462 * @param env pointer to environment struct
    00463 */
    00464 AXIS2_EXTERN int AXIS2_CALL
    00465 saml_response_build(saml_response_t *response, axiom_node_t *node,
    00466                                         const axutil_env_t *env);
    00467 /*
    00468 * Serialize a saml response to a om node.
    00469 * @param request response to be serialized
    00470 * @param parent if specified created node will be a child of this
    00471 * @param env pointer to environment struct
    00472 */
    00473 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
    00474 saml_response_to_om(saml_response_t *response, axiom_node_t *parent,
    00475                                         const axutil_env_t *env);
    00476 /*
    00477 * Returns the unique ID of the response.
    00478 * @param request SAML response object
    00479 * @param env pointer to environment struct
    00480 */
    00481 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
    00482 saml_response_get_id(saml_response_t *response, const axutil_env_t *env);
    00483
    00484 /*
    00485  * Set the information required to sign the message.
    00486  * @param assertion SAML response object
    00487  * @param env pointer to environment struct
    00488  * @param sign_ctx oxs_sign_ctx_t object which contains the sign information
    00489  */
    00490 AXIS2_EXTERN int AXIS2_CALL
    00491 saml_response_set_signature(saml_response_t *response,
    00492                                                         const axutil_env_t *env, oxs_sign_ctx_t *sig_ctx);
    00493
    00494 AXIS2_EXTERN int AXIS2_CALL
    00495 saml_response_unset_signature(saml_response_t *response, const axutil_env_t *env);
    00496
    00497 /*
    00498  * Sign the response using the information set in the
    00499  * saml_response_set_default_signature or saml_response_set_signature method.
    00500  * @param response SAML response object
    00501  * @param node axiom node to of the response
    00502  * @param env pointer to environment struct
    00503  */
    00504 AXIS2_EXTERN int AXIS2_CALL
    00505 saml_response_sign(saml_response_t *response, axiom_node_t *node,
    00506                                    const axutil_env_t *env);
    00507
    00508 /*
    00509  * Set the default information required to sign the message.
    00510  * @param response SAML response object
    00511  * @param env pointer to environment struct
    00512  * @param sign_ctx oxs_sign_ctx_t object which contains the sign information
    00513  * oxs_sign_ctx should contain the key info and the certification info.
    00514  * all other information are set to default settings.
    00515  */
    00516 AXIS2_EXTERN void AXIS2_CALL
    00517 saml_response_set_default_signature(saml_response_t *response,
    00518                                                                         const axutil_env_t *env, oxs_sign_ctx_t *sig_ctx);
    00519
    00520 /*
    00521  * Set the minor version of the response
    00522  * @param response SAML response object
    00523  * @param env pointer to environment struct
    00524  * @param version minor version number
    00525  */
    00526 AXIS2_EXTERN int AXIS2_CALL
    00527 saml_response_set_minor_version(saml_response_t *response,
    00528                                                                 const axutil_env_t *env, int version);
    00529 /*
    00530  * Set the major version of the response
    00531  * @param response SAML response object
    00532  * @param env pointer to environment struct
    00533  * @param version major version number
    00534  */
    00535 AXIS2_EXTERN int AXIS2_CALL
    00536 saml_response_set_major_version(saml_response_t *response,
    00537                                                                 const axutil_env_t *env, int version);
    00538 /*
    00539  * Set the issue instant of the response
    00540  * @param response SAML response object
    00541  * @param env pointer to environment struct
    00542  * @param time time instant of the saml issue
    00543  */
    00544 AXIS2_EXTERN int AXIS2_CALL
    00545 saml_response_set_issue_instant(saml_response_t *response,
    00546                                                                 const axutil_env_t *env, axutil_date_time_t *date_time);
    00547 /*
    00548  * Returns the time instant of the response
    00549  * @param response SAML response object
    00550  * @param env pointer to the environment struct
    00551  */
    00552 AXIS2_EXTERN  axutil_date_time_t* AXIS2_CALL
    00553 saml_response_get_issue_instant(saml_response_t *response, const axutil_env_t *env);
    00554
    00555 /*
    00556  * Set the SAML recepient of the response
    00557  * @param response SAML response
    00558  * @param recepient SAML recepient identifier
    00559  * @param env pointer to the environment struct
    00560  */
    00561 AXIS2_EXTERN int AXIS2_CALL
    00562 saml_response_set_recepient(saml_response_t *response, const axutil_env_t *env,
    00563                                                         axis2_char_t *recepient);
    00564 /*
    00565  * Returns the SAML response recepient.
    00566  * @param response SAML response
    00567  * @param env pointer to the environment struct
    00568  */
    00569 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
    00570 saml_response_get_recepient(saml_response_t *response, const axutil_env_t *env);
    00571
    00572 /*
    00573  * Set the status of the SAML response.
    00574  * @param response SAML response
    00575  * @param status SAML status
    00576  * @param env pointer to the environment struct
    00577  */
    00578 AXIS2_EXTERN int AXIS2_CALL
    00579 saml_response_set_status(saml_response_t *response, const axutil_env_t *env,
    00580                                                  saml_status_t *status);
    00581 /*
    00582  * Returns the status of the recieved SAML response
    00583  * @param response SAML response
    00584  * @param env pointer to the environment struct
    00585  */
    00586 AXIS2_EXTERN saml_status_t* AXIS2_CALL
    00587 saml_response_get_status(saml_response_t *response, const axutil_env_t *env);
    00588
    00589 /*
    00590  * Set the set of SAML Assertion of the SAML response
    00591  * @param response SAML response
    00592  * @param assertions list of SAML Assertions
    00593  * @param env pointer to the environment struct
    00594  */
    00595 AXIS2_EXTERN int AXIS2_CALL
    00596 saml_response_set_assertions(saml_response_t *response,
    00597                                                          const axutil_env_t *env, axutil_array_list_t *assertions);
    00598
    00599 /*
    00600  * Returns the set of SAML Assertions of response
    00601  * @param response SAML response
    00602  * @param env pointer to the environment struct
    00603  */
    00604 AXIS2_EXTERN axutil_array_list_t* AXIS2_CALL
    00605 saml_response_get_assertions(saml_response_t *response, const axutil_env_t *env);
    00606
    00607 /*
    00608  * Add a SAML assertion to the response
    00609  * @param response SAML response
    00610  * @param assertion SAML Assertion
    00611  * @param env pointer to the environment struct
    00612  */
    00613 AXIS2_EXTERN int AXIS2_CALL
    00614 saml_response_add_assertion(saml_response_t *response, const axutil_env_t *env,
    00615                                                         saml_assertion_t *assertion);
    00616
    00617 /*
    00618  * Remove a SAML assertion at the specified index
    00619  * @param response SAML response
    00620  * @param index the specific index to remove
    00621  * @param env pointer to the environment struct
    00622  */
    00623 AXIS2_EXTERN int AXIS2_CALL
    00624 saml_response_remove_assertion(saml_response_t *response, const axutil_env_t *env, int index);
    00625
    00626 /*
    00627  * Set the request reference of the SAML response
    00628  * @param response SAML response
    00629  * @param request_response request reference
    00630  * @param env pointer to the environment struct
    00631  */
    00632 AXIS2_EXTERN int AXIS2_CALL
    00633 saml_response_set_in_reponses_to(saml_response_t *response,
    00634                                                                  const axutil_env_t *env, axis2_char_t *request_response);
    00635
    00636 /*
    00637  *  Creates a saml query.
    00638  *  @param env pointer to environment struct
    00639  */
    00640 AXIS2_EXTERN saml_query_t* AXIS2_CALL
    00641 saml_query_create(const axutil_env_t *env);
    00642
    00643 /*
    00644  * Build the saml query from an axiom node.
    00645  * @param query SAML query to be populated
    00646  * @param node axiom node of SAML query
    00647  * @param env pointer to environment struct
    00648  */
    00649 AXIS2_EXTERN int AXIS2_CALL
    00650 saml_query_build(saml_query_t *query, axiom_node_t *node, const axutil_env_t *env);
    00651
    00652
    00653 /*
    00654 * Serialize a saml query to a om node.
    00655 * @param query SAML response to be serialized
    00656 * @param parent if specified created node will be a child of this
    00657 * @param env pointer to environment struct
    00658 */
    00659 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
    00660 saml_query_to_om(saml_query_t *query, axiom_node_t *parent, const axutil_env_t *env);
    00661
    00662 /*
    00663  * Free a saml query
    00664  * @param env pointer to environment struct
    00665  */
    00666 AXIS2_EXTERN void AXIS2_CALL
    00667 saml_query_free(saml_query_t *query, const axutil_env_t *env);
    00668
    00669 /*
    00670  *  Creates a saml subject query.
    00671  *  @param env pointer to environment struct
    00672  */
    00673
    00674 AXIS2_EXTERN saml_subject_query_t* AXIS2_CALL
    00675 saml_subject_query_create(const axutil_env_t *env);
    00676
    00677 /*
    00678  * Free a saml subject query
    00679  * @param env pointer to environment struct
    00680  */
    00681 AXIS2_EXTERN void AXIS2_CALL
    00682 saml_subject_query_free(saml_subject_query_t* subject_query, const axutil_env_t *env);
    00683
    00684 /*
    00685  * Build the saml subject query from an axiom node.
    00686  * @param query SAML subject query to be populated
    00687  * @param node axiom node of SAML subject query
    00688  * @param env pointer to environment struct
    00689  */
    00690 AXIS2_EXTERN int AXIS2_CALL
    00691 saml_subject_query_build(saml_subject_query_t* subject_query,
    00692                                                  axiom_node_t *node, const axutil_env_t *env);
    00693
    00694 /*
    00695 * Serialize a saml subject query to a om node.
    00696 * @param query saml subject query to be serialized
    00697 * @param parent if specified created node will be a child of this
    00698 * @param env pointer to environment struct
    00699 */
    00700 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
    00701 saml_subject_query_to_om(saml_subject_query_t *subject_query,
    00702                                                  axiom_node_t *parent, const axutil_env_t *env);
    00703 /*
    00704  *  Creates a saml authentication query.
    00705  *  @param env pointer to environment struct
    00706  */
    00707 AXIS2_EXTERN saml_authentication_query_t* AXIS2_CALL
    00708 saml_authentication_query_create(const axutil_env_t *env);
    00709
    00710 /*
    00711  * Free a saml authentication query
    00712  * @param env pointer to environment struct
    00713  */
    00714 AXIS2_EXTERN void AXIS2_CALL
    00715 saml_authentication_query_free(saml_authentication_query_t *authentication_query,
    00716                                                            const axutil_env_t *env);
    00717 /*
    00718  * Build the saml authentication query from an axiom node.
    00719  * @param query SAML authentication query to be populated
    00720  * @param node axiom node of SAML query
    00721  * @param env pointer to environment struct
    00722  */
    00723 AXIS2_EXTERN int AXIS2_CALL
    00724 saml_authentication_query_build(saml_authentication_query_t* authentication_query,
    00725                                                                 axiom_node_t *node, const axutil_env_t *env);
    00726
    00727 /*
    00728 * Serialize a saml authentication query to a om node.
    00729 * @param authentication_query saml authentication query to be serialized
    00730 * @param parent if specified created node will be a child of this
    00731 * @param env pointer to environment struct
    00732 */
    00733 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
    00734 saml_authentication_query_to_om(saml_authentication_query_t *authentication_query,
    00735                                                                 axiom_node_t *parent, const axutil_env_t *env);
    00736
    00737 /*
    00738  * Set authetication method of saml authentication query.
    00739  * @param authentication_query saml authentication query
    00740  * @param env pointer to environment struct
    00741  * @param authentication_mtd required authentication method in the secifying query
    00742  */
    00743 AXIS2_EXTERN int AXIS2_CALL
    00744 saml_auth_query_set_authentication_method(
    00745         saml_authentication_query_t *authentication_query,
    00746         const axutil_env_t *env,
    00747         axis2_char_t *authentication_mtd);
    00748
    00749 /*
    00750  * Returns the authentication method of the saml authentication query.
    00751  * @param authentication_query saml authentication query
    00752  * @param env pointer to the environment struct
    00753  */
    00754 AXIS2_EXTERN axis2_char_t * AXIS2_CALL
    00755 saml_auth_query_get_authentication_method(
    00756         saml_authentication_query_t *authentication_query,
    00757         const axutil_env_t *env);
    00758
    00759 /*
    00760  *  Creates a saml attribute query.
    00761  *  @param env pointer to environment struct
    00762  */
    00763 AXIS2_EXTERN saml_attr_query_t* AXIS2_CALL
    00764 saml_attr_query_create(const axutil_env_t *env);
    00765
    00766 /*
    00767  * Free a saml attribute query
    00768  * @param env pointer to environment struct
    00769  */
    00770 AXIS2_EXTERN void AXIS2_CALL
    00771 saml_attr_query_free(saml_attr_query_t* attribute_query, const axutil_env_t *env);
    00772
    00773 /*
    00774  * Build the saml attribute query from an axiom node.
    00775  * @param attribute_query SAML attribute query to be populated
    00776  * @param node axiom node of SAML query
    00777  * @param env pointer to environment struct
    00778  */
    00779 AXIS2_EXTERN int AXIS2_CALL
    00780 saml_attr_query_build(saml_attr_query_t* attribute_query,
    00781                                           axiom_node_t *node, const axutil_env_t *env);
    00782
    00783 /*
    00784 * Serialize a saml attribute to a om node.
    00785 * @param attribute_query saml attribute query to be serialized
    00786 * @param parent if specified created node will be a child of this
    00787 * @param env pointer to environment struct
    00788 */
    00789 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
    00790 saml_attr_query_to_om(saml_attr_query_t *attribute_query,
    00791                                           axiom_node_t *parent, const axutil_env_t *env);
    00792
    00793 /*
    00794  * Returns the saml subject of the saml query.
    00795  * @param query saml query
    00796  * @param env pointer to the environment struct
    00797  */
    00798 AXIS2_EXTERN saml_subject_t* AXIS2_CALL
    00799 saml_query_get_subject(saml_query_t* query,
    00800                                                 const axutil_env_t *env);
    00801 /*
    00802  * Set the subject of a saml query.
    00803  * @param query saml query
    00804  * @param env pointer to the environment struct
    00805  * @param subject saml subject
    00806  */
    00807 AXIS2_EXTERN int AXIS2_CALL
    00808 saml_query_set_subject(saml_query_t *query, const axutil_env_t *env,
    00809                                            saml_subject_t *subject);
    00810 /*
    00811  * Set the type of the saml query.
    00812  * @param query saml query
    00813  * @param env pointer to the environment struct
    00814  * @param type type of the saml query
    00815  */
    00816 AXIS2_EXTERN int AXIS2_CALL
    00817 saml_query_set_type(saml_query_t *query, const axutil_env_t *env, axis2_char_t *type);
    00818
    00819 /*
    00820  * Set the saml specific query object of saml query
    00821  * @param query saml query
    00822  * @param spec_query specific query object to be set as the saml query
    00823  * @param type the type of the specifying query
    00824  * spec_query can be any type of query defined in saml queries.
    00825  * the specified saml queries, saml subject query, attribute query,
    00826  * authentication query, athorization decision query
    00827  */
    00828 AXIS2_EXTERN int AXIS2_CALL
    00829 saml_query_set_query(saml_query_t *query, const axutil_env_t *env,
    00830                                          void *spec_query,
    00831                                          axis2_char_t *type);
    00832
    00833 /*
    00834  * Set the resource required of saml attribute query.
    00835  * @param attr_query saml attribute query
    00836  * @param env pointer to environment struct
    00837  * @param resource specific saml resource
    00838  */
    00839 AXIS2_EXTERN int AXIS2_CALL
    00840 saml_attr_query_set_resource(saml_attr_query_t *attr_query,
    00841                                                          const axutil_env_t *env, axis2_char_t *resource);
    00842
    00843 /*
    00844  * Returns the saml resource required of saml attribute query.
    00845  * @param attr_query saml attribute query
    00846  * @param env pointer to environment struct
    00847  */
    00848 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
    00849 saml_attr_query_get_resource(saml_attr_query_t *attr_query, const axutil_env_t *env);
    00850
    00851 /*
    00852  * Set a set of attribute designators of the saml attribute query.
    00853  * @param env pointer to environment struct
    00854  * @param saml_designators list of saml attribute designators
    00855  */
    00856 AXIS2_EXTERN int AXIS2_CALL
    00857 saml_attr_query_set_designators(saml_attr_query_t *attr_query,
    00858                                                                 const axutil_env_t *env,
    00859                                                                 axutil_array_list_t *saml_designators);
    00860 /*
    00861  * Returns the set of attribute designators of saml attribute query.
    00862  * @param attr_query saml attribute query
    00863  * @param env pointer to environment struct
    00864  */
    00865 AXIS2_EXTERN axutil_array_list_t* AXIS2_CALL
    00866 saml_attr_query_get_designators(saml_attr_query_t *attr_query, const axutil_env_t *env);
    00867
    00868 /*
    00869  * Add a saml attribute designator to the saml attribute query.
    00870  * @param attr_query saml attribute query
    00871  * @param env pointer to environment struct
    00872  * @param desig saml attribute designator object
    00873  */
    00874 AXIS2_EXTERN int AXIS2_CALL
    00875 saml_attr_query_add_designators(saml_attr_query_t *attr_query, const axutil_env_t *env,
    00876                                                                 saml_attr_desig_t *desig);
    00877 /*
    00878  * Remove saml attribute designator at the specified index.
    00879  * @param attr_query saml attribute query
    00880  * @param env pointer to environment struct
    00881  * @param index the specified index to remove
    00882  */
    00883 AXIS2_EXTERN int AXIS2_CALL
    00884 saml_attr_query_remove_designator(saml_attr_query_t *attr_query, const axutil_env_t *env,
    00885                                                                   int index);
    00886
    00887 /*
    00888  *  Creates a saml authorization decision query.
    00889  *  @param env pointer to environment struct
    00890  */
    00891 AXIS2_EXTERN saml_autho_decision_query_t* AXIS2_CALL
    00892 saml_autho_decision_query_create(const axutil_env_t *env);
    00893
    00894 /*
    00895  * Free a saml authorizaion decision query
    00896  * @param env pointer to environment struct
    00897  */
    00898 AXIS2_EXTERN void AXIS2_CALL
    00899 saml_autho_decision_query_free(saml_autho_decision_query_t* autho_decision_query,
    00900                                                            const axutil_env_t *env);
    00901
    00902 /*
    00903  * Build the saml authorization decision query from an axiom node.
    00904  * @param query SAML authorization decision query to be populated
    00905  * @param node axiom node of SAML authorization decision query
    00906  * @param env pointer to environment struct
    00907  */
    00908 AXIS2_EXTERN int AXIS2_CALL
    00909 saml_autho_decision_query_build(saml_autho_decision_query_t* autho_decision_query,
    00910                                                                 axiom_node_t *node, const axutil_env_t *env);
    00911
    00912 /*
    00913 * Serialize a saml authorization decision query to a om node.
    00914 * @param autho_decision_query authorization decision query to be serialized
    00915 * @param parent if specified created node will be a child of this
    00916 * @param env pointer to environment struct
    00917 */
    00918 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
    00919 saml_autho_decision_query_to_om(saml_autho_decision_query_t *autho_decision_query,
    00920                                                                 axiom_node_t *parent, const axutil_env_t *env);
    00921 /*
    00922  * Set the resource required of saml authorization decision query.
    00923  * @param autho_dec_query saml authorization decision query
    00924  * @param env pointer to environment struct
    00925  * @param resource saml resource required
    00926  */
    00927 AXIS2_EXTERN int AXIS2_CALL
    00928 saml_autho_decision_query_set_resource(
    00929                         saml_autho_decision_query_t *autho_dec_query,
    00930                         const axutil_env_t *env,
    00931                         axis2_char_t *resource);
    00932 /*
    00933  * Returns the saml resource of saml authorization decision query.
    00934  * @param autho_dec_query saml authorization decision query
    00935  * @param env pointer to environment struct
    00936  */
    00937 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
    00938 saml_autho_decision_query_get_resource(saml_autho_decision_query_t *autho_dec_query,
    00939                                                                                                                  const axutil_env_t *env);
    00940 /*
    00941  * Set a set of action of saml authorization decision query.
    00942  * @param autho_dec_query saml authorization decision query
    00943  * @param env pointer to the environment struct
    00944  * @param actions list of saml action objects
    00945  */
    00946 AXIS2_EXTERN int AXIS2_CALL
    00947 saml_autho_decision_query_set_actions(
    00948                         saml_autho_decision_query_t *autho_dec_query,
    00949                         const axutil_env_t *env,
    00950                         axutil_array_list_t *actions);
    00951 /*
    00952  * Returns the set of actions of saml authorization decision query.
    00953  * @param autho_dec_query saml authorization decision query
    00954  * @param env envionment struct
    00955  */
    00956 AXIS2_EXTERN axutil_array_list_t* AXIS2_CALL
    00957 saml_autho_decision_query_get_actions(
    00958                         saml_autho_decision_query_t *autho_dec_query,
    00959                         const axutil_env_t *env);
    00960
    00961 /*
    00962  * Add a saml action to saml authorization decision query.
    00963  * @param autho_dec_query saml authorization decision query
    00964  * @param env pointer to environment struct
    00965  * @param action saml action object
    00966  */
    00967 AXIS2_EXTERN int AXIS2_CALL
    00968 saml_autho_decision_query_add_action(
    00969                         saml_autho_decision_query_t *autho_dec_query,
    00970                         const axutil_env_t *env,
    00971                         saml_action_t *action);
    00972 /*
    00973  * Remove a saml action at the the specified index.
    00974  * @param autho_dec_query saml authorization decision query
    00975  * @param env pointer to environment struct
    00976  * @param index specified index to remove
    00977  */
    00978 AXIS2_EXTERN int AXIS2_CALL
    00979 saml_autho_decision_remove_action(saml_autho_decision_query_t *autho_dec_query,
    00980                                                                   const axutil_env_t *env,
    00981                                                                   int index);
    00982 /*
    00983  * Set a saml evidence of the saml authorization decision query.
    00984  * @param autho_dec_query saml authorization decision query
    00985  * @param env pointer to environment struct
    00986  * @param evidence saml evidence object
    00987  */
    00988 AXIS2_EXTERN int AXIS2_CALL
    00989 saml_autho_decision_query_set_evidence(
    00990                         saml_autho_decision_query_t *autho_dec_query,
    00991                         const axutil_env_t *env,
    00992                         saml_evidence_t *evidence);
    00993 /*
    00994  * Returns the saml evidence of saml authorization decision query.
    00995  * @param autho_dec_query saml authorization decision query
    00996  * @param env pointer to environment struct
    00997  */
    00998 AXIS2_EXTERN saml_evidence_t* AXIS2_CALL
    00999 saml_autho_decision_query_get_evidence(
    01000                         saml_autho_decision_query_t *autho_dec_query,
    01001                         const axutil_env_t *env);
    01002
    01003 /*
    01004  * Build the saml status from an axiom node.
    01005  * @param query SAML status to be populated
    01006  * @param node axiom node of SAML status
    01007  * @param env pointer to environment struct
    01008  */
    01009 AXIS2_EXTERN int AXIS2_CALL
    01010 saml_status_build(saml_status_t *status, axiom_node_t *node, const axutil_env_t *env);
    01011
    01012 /*
    01013 * Serialize a saml status to a om node.
    01014 * @param status saml status to be serialized
    01015 * @param parent if specified created node will be a child of this
    01016 * @param env pointer to environment struct
    01017 */
    01018 AXIS2_EXTERN axiom_node_t* AXIS2_CALL saml_status_to_om(saml_status_t *status,
    01019                                                                                                                 axiom_node_t *parent,
    01020                                                                                                                 const axutil_env_t *env);
    01021
    01022 /*
    01023  *  Creates a saml status.
    01024  *  @param env pointer to environment struct
    01025  */
    01026 AXIS2_EXTERN saml_status_t* AXIS2_CALL
    01027 saml_status_create(const axutil_env_t *env);
    01028
    01029 /*
    01030  * Free a saml status
    01031  * @param env pointer to environment struct
    01032  */
    01033 AXIS2_EXTERN void
    01034 saml_status_free(saml_status_t *status, const axutil_env_t *env);
    01035
    01036 /*
    01037  * Set the saml status value to be returned in saml status.
    01038  * @param status saml status object
    01039  * @param qname axutil qname object which specify saml status value
    01040  * @param env pointer to environment struct
    01041 */
    01042 AXIS2_EXTERN int AXIS2_CALL
    01043 saml_status_set_status_value(saml_status_t *status,
    01044                                                          const axutil_env_t *env, axutil_qname_t *qname);
    01045
    01046 /*
    01047  * Returns the saml status value of saml status.
    01048  * @param status saml status
    01049  * @param env pointer to environment struct
    01050  */
    01051 AXIS2_EXTERN axutil_qname_t* AXIS2_CALL
    01052 saml_status_get_status_value(saml_status_t *status, const axutil_env_t *env);
    01053
    01054 /*
    01055  * Set the status message of saml status
    01056  * @param status saml status object
    01057  * @param env pointer to environment struct
    01058  * @param msg status message to be set in saml status
    01059  */
    01060 AXIS2_EXTERN int AXIS2_CALL
    01061 saml_status_set_status_msg(saml_status_t *status, const axutil_env_t *env,
    01062                                                    axis2_char_t *msg);
    01063 /*
    01064  * Set the status code of saml status object.
    01065  * @param status saml status object
    01066  * @param env pointer to environment struct
    01067  * @param code status code to be set in saml status
    01068  */
    01069 AXIS2_EXTERN int AXIS2_CALL
    01070 saml_status_set_status_code(saml_status_t *status, const axutil_env_t *env,
    01071                                                         axis2_char_t *code);
    01072 /*
    01073  * Returns the status message of saml status.
    01074  * @param status saml status struct
    01075  * @env pointer to environment struct
    01076  */
    01077 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
    01078 saml_status_get_status_msg(saml_status_t *status, const axutil_env_t *env);
    01079 /*
    01080  * Set the saml status detail of saml status.
    01081  * @param status saml status struct
    01082  * @param det axiom node struct to be set as saml status detail
    01083  * @param env pointer to environment struct
    01084  */
    01085 AXIS2_EXTERN int AXIS2_CALL
    01086 saml_status_set_status_detail(saml_status_t *status, axiom_node_t *det,
    01087                                                           const axutil_env_t *env);
    01088 /*
    01089  * Returns the saml status detail node of saml status
    01090  * @param status saml status struct
    01091  * @param env pointer to environment struct
    01092  */
    01093 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
    01094 saml_status_get_status_detail(saml_status_t *status, const axutil_env_t *env);
    01095
    01096 /*
    01097  *  Creates a saml artifact.
    01098  *  @param env pointer to environment struct
    01099  */
    01100 AXIS2_EXTERN saml_artifact_t* AXIS2_CALL
    01101 saml_artifact_create(const axutil_env_t *env);
    01102
    01103 /*
    01104  * Free a saml artifact
    01105  * @param env pointer to environment struct
    01106  */
    01107 AXIS2_EXTERN void AXIS2_CALL
    01108 saml_artifact_free(saml_artifact_t *artifact, const axutil_env_t *env);
    01109
    01110 /*
    01111  * Returns the data value of saml artifact.
    01112  * @param artifact saml artifact srtuct
    01113  * @param env pointer to environment struct
    01114  */
    01115 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
    01116 saml_artifact_get_data(saml_artifact_t *artifact, const axutil_env_t *env);
    01117
    01118 /*
    01119  * Set data value of saml artifact.
    01120  * @param artifact saml artifact
    01121  * @param env pointer to environment struct
    01122  * @data data value to be set in smal artifact
    01123  */
    01124 AXIS2_EXTERN int AXIS2_CALL
    01125 saml_artifact_set_data(saml_artifact_t *artifact, const axutil_env_t *env,
    01126                                            axis2_char_t *data);
    01127 /*
    01128  * Verify a signed saml response.
    01129  * @param response saml response struct
    01130  * @param env pointer to environement struct
    01131  */
    01132 AXIS2_EXTERN int AXIS2_CALL
    01133 saml_response_signature_verify(saml_response_t *response, const axutil_env_t *env);
    01134
    01135 /*
    01136  * Check whether the saml response has to sign.
    01137  * @param response saml response struct
    01138  * @param env pointer to environment struct
    01139  */
    01140 AXIS2_EXTERN int AXIS2_CALL
    01141 saml_response_is_sign_set(saml_response_t *response, const axutil_env_t *env);
    01142
    01143 /*
    01144  * Check whether the recieved response is signed.
    01145  * @param response saml response struct
    01146  * @param env pointer to environment struct
    01147  */
    01148 AXIS2_EXTERN int AXIS2_CALL
    01149 saml_response_is_signed(saml_response_t *response, const axutil_env_t *env);
    01150
    01151 /*
    01152  * Verify a signed saml request.
    01153  * @param response saml request struct
    01154  * @param env pointer to environement struct
    01155  */
    01156 AXIS2_EXTERN int AXIS2_CALL
    01157 saml_request_signature_verify(saml_request_t *request, const axutil_env_t *env);
    01158
    01159 /*
    01160  * Check whether the saml request has to sign.
    01161  * @param request saml request struct
    01162  * @param env pointer to environment struct
    01163  */
    01164 AXIS2_EXTERN int AXIS2_CALL
    01165 saml_request_is_sign_set(saml_request_t *request, const axutil_env_t *env);
    01166
    01167 /*
    01168  * Check whether the recieved request is signed.
    01169  * @param request saml request struct
    01170  * @param env pointer to environment struct
    01171  */
    01172 AXIS2_EXTERN int AXIS2_CALL
    01173 saml_request_is_signed(saml_request_t *request, const axutil_env_t *env);
    01174
    01175 #ifdef __cplusplus
    01176 }
    01177 #endif
    01178
    01179 #endif
    01180