END_TEST START_TEST(test06_lib_statuscode) { /* check status code value in samlp:Response; it is a QName, if it * starts with lib:, that namespace must be defined. (was bug#416) */ LassoSamlpResponse *response = LASSO_SAMLP_RESPONSE(lasso_samlp_response_new()); char *dump = NULL; lasso_assign_string(response->Status->StatusCode->Value, LASSO_SAML_STATUS_CODE_SUCCESS); dump = lasso_node_dump(LASSO_NODE(response)); fail_unless(strstr(dump, "xmlns:lib=") == NULL, "liberty namespace should not be defined"); lasso_release_string(dump); lasso_assign_string(response->Status->StatusCode->Value, LASSO_SAML_STATUS_CODE_RESPONDER); response->Status->StatusCode->StatusCode = lasso_samlp_status_code_new(); response->Status->StatusCode->StatusCode->Value = g_strdup( LASSO_LIB_STATUS_CODE_UNKNOWN_PRINCIPAL); dump = lasso_node_dump(LASSO_NODE(response)); fail_unless(strstr(dump, "xmlns:lib=") != NULL, "liberty namespace should be defined"); lasso_release_string(dump); g_object_unref(response); }
/** * lasso_lib_name_identifier_mapping_response_new_full: * @providerID: the providerID of the responder * @statusCodeValue: a response status code * @request: the request which is asnwered by this response * @sign_type: a #LassoSignatureType value * @sign_method: a #LassoSignatureMethod value * * Creates a new #LassoLibNameIdentifierMappingResponse object and initializes * it with the parameters. * * Return value: a newly created #LassoLibNameIdentifierMappingResponse object **/ LassoNode* lasso_lib_name_identifier_mapping_response_new_full(char *providerID, const char *statusCodeValue, LassoLibNameIdentifierMappingRequest *request, LassoSignatureType sign_type, LassoSignatureMethod sign_method) { LassoLibNameIdentifierMappingResponse *response; response = g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL); lasso_samlp_response_abstract_fill( LASSO_SAMLP_RESPONSE_ABSTRACT(response), LASSO_SAMLP_REQUEST_ABSTRACT(request)->RequestID, request->ProviderID); LASSO_SAMLP_RESPONSE_ABSTRACT(response)->sign_type = sign_type; LASSO_SAMLP_RESPONSE_ABSTRACT(response)->sign_method = sign_method; response->ProviderID = g_strdup(providerID); response->Status = lasso_samlp_status_new(); response->Status->StatusCode = lasso_samlp_status_code_new(); response->Status->StatusCode->Value = g_strdup(statusCodeValue); return LASSO_NODE(response); }
/** * lasso_samlp_response_new: * * Creates a new #LassoSamlpResponse object. * * Return value: a newly created #LassoSamlpResponse object **/ LassoNode* lasso_samlp_response_new() { LassoSamlpResponseAbstract *response; LassoSamlpStatusCode *status_code; LassoSamlpStatus *status; response = g_object_new(LASSO_TYPE_SAMLP_RESPONSE, NULL); response->ResponseID = lasso_build_unique_id(32); response->MajorVersion = LASSO_SAML_MAJOR_VERSION_N; response->MinorVersion = LASSO_SAML_MINOR_VERSION_N; response->IssueInstant = lasso_get_current_time(); /* Add Status */ status = LASSO_SAMLP_STATUS(lasso_samlp_status_new()); status_code = LASSO_SAMLP_STATUS_CODE(lasso_samlp_status_code_new()); status_code->Value = g_strdup(LASSO_SAML_STATUS_CODE_REQUEST_DENIED); status->StatusCode = status_code; LASSO_SAMLP_RESPONSE(response)->Status = status; return LASSO_NODE(response); }