AXIS2_EXTERN saml_subject_query_t* AXIS2_CALL saml_subject_query_create(const axutil_env_t *env) { saml_subject_query_t *subject_query = NULL; subject_query = (saml_subject_query_t *)AXIS2_MALLOC(env->allocator, sizeof(saml_subject_query_t)); if(subject_query) { subject_query->subject = saml_subject_create(env); } return subject_query; }
AXIS2_EXTERN saml_authentication_query_t* AXIS2_CALL saml_authentication_query_create(const axutil_env_t *env) { saml_authentication_query_t *authentication_query = NULL; authentication_query = (saml_authentication_query_t*)AXIS2_MALLOC(env->allocator, sizeof(saml_authentication_query_t)); if(authentication_query) { authentication_query->subject = saml_subject_create(env); authentication_query->auth_method = NULL; } return authentication_query; }
AXIS2_EXTERN saml_attr_query_t* AXIS2_CALL saml_attr_query_create(const axutil_env_t *env) { saml_attr_query_t *attribute_query = NULL; attribute_query = (saml_attr_query_t *)AXIS2_MALLOC(env->allocator, sizeof(saml_attr_query_t)); if(attribute_query) { attribute_query->resource = NULL; attribute_query->subject = saml_subject_create(env); attribute_query->attr_desigs = axutil_array_list_create(env, SAML_ARRAY_LIST_DEF); } return attribute_query; }
AXIS2_EXTERN saml_autho_decision_query_t* AXIS2_CALL saml_autho_decision_query_create(const axutil_env_t *env) { saml_autho_decision_query_t *autho_decision_query = NULL; autho_decision_query = (saml_autho_decision_query_t *)AXIS2_MALLOC(env->allocator, sizeof(saml_autho_decision_query_t)); if(autho_decision_query) { autho_decision_query->subject = saml_subject_create(env); autho_decision_query->resource = NULL; autho_decision_query->saml_actions = axutil_array_list_create(env, SAML_ARRAY_LIST_DEF); autho_decision_query->evidence = saml_evidence_create(env); } return autho_decision_query; }
saml_subject_t * create_subject(axutil_env_t *env) { saml_subject_t *subject = NULL; saml_named_id_t *id = NULL; subject = saml_subject_create(env); id = saml_named_id_create(env); saml_named_id_set_name(id, env, "Computer Science & Engineering Department"); saml_named_id_set_format(id, env, SAML_EMAIL_ADDRESS); saml_named_id_set_name_qualifier(id, env, "University of Moratuwa"); saml_subject_set_named_id(subject, env, id); saml_subject_add_confirmation(subject, env, SAML_SUB_CONFIRMATION_ARTIFACT); saml_subject_add_confirmation(subject, env, SAML_SUB_CONFIRMATION_BEARER); return subject; }
axiom_node_t * AXIS2_CALL create_saml_assertion(const axutil_env_t *env) { saml_assertion_t *assertion = NULL; saml_attr_stmt_t *attr_stmt = NULL; saml_subject_t *subject = NULL; saml_named_id_t *named_id = NULL; saml_attr_t *attr = NULL; axiom_node_t *attr_val = NULL; axiom_element_t *e = NULL; saml_stmt_t *stmt = NULL; assertion = saml_assertion_create(env); attr_stmt = saml_attr_stmt_create(env); subject = saml_subject_create(env); saml_assertion_set_issue_instant(assertion, env, axutil_date_time_create(env)); saml_assertion_set_issuer(assertion, env, "www.mrt.ac.lk"); saml_assertion_set_minor_version(assertion, env, 1); saml_subject_add_confirmation(subject, env, SAML_SUB_CONFIRMATION_SENDER_VOUCHES); named_id = saml_named_id_create(env); saml_named_id_set_name(named_id, env, "cse07"); saml_subject_set_named_id(subject, env, named_id); attr = saml_attr_create(env); saml_attr_set_name(attr, env, "csestudent"); saml_attr_set_namespace(attr, env, "www.mrt.ac.lk/cse"); e = axiom_element_create(env, NULL, "noofstudent", NULL, &attr_val); axiom_element_set_text(e, env, "10", attr_val); saml_attr_add_value(attr, env, attr_val); saml_attr_stmt_set_subject(attr_stmt, env, subject); saml_attr_stmt_add_attribute(attr_stmt, env, attr); stmt = saml_stmt_create(env); saml_stmt_set_stmt(stmt, env, attr_stmt, SAML_STMT_ATTRIBUTESTATEMENT); saml_assertion_add_statement(assertion, env, stmt); return saml_assertion_to_om(assertion, NULL, env); }
saml_subject_t * AXIS2_CALL create_subject(const axutil_env_t *env, rampart_saml_token_t *saml) { saml_subject_t *subject = NULL; saml_named_id_t *id = NULL; axiom_node_t *key_info = NULL; subject = saml_subject_create(env); id = saml_named_id_create(env); saml_named_id_set_name(id, env, "Computer Science & Engineering Department"); saml_named_id_set_format(id, env, SAML_EMAIL_ADDRESS); saml_named_id_set_name_qualifier(id, env, "University of Moratuwa"); saml_subject_set_named_id(subject, env, id); saml_subject_add_confirmation(subject, env, SAML_SUB_CONFIRMATION_HOLDER_OF_KEY); key_info = create_key_info(env, saml); saml_subject_set_key_info(subject, env, key_info); return subject; }