Blame tests/assertion_query_saml2.c

Packit 228f82
/*
Packit 228f82
 * Lasso library C unit tests
Packit 228f82
 *
Packit 228f82
 * Copyright (C) 2004-2007 Entr'ouvert
Packit 228f82
 * http://lasso.entrouvert.org
Packit 228f82
 *
Packit 228f82
 * Authors: See AUTHORS file in top-level directory.
Packit 228f82
 *
Packit 228f82
 * This program is free software; you can redistribute it and/or modify
Packit 228f82
 * it under the terms of the GNU General Public License as published by
Packit 228f82
 * the Free Software Foundation; either version 2 of the License, or
Packit 228f82
 * (at your option) any later version.
Packit 228f82
 *
Packit 228f82
 * This program is distributed in the hope that it will be useful,
Packit 228f82
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 228f82
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 228f82
 * GNU General Public License for more details.
Packit 228f82
 *
Packit 228f82
 * You should have received a copy of the GNU General Public License
Packit 228f82
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
Packit 228f82
 */
Packit 228f82
Packit 228f82
#include <stdlib.h>
Packit 228f82
#include <string.h>
Packit 228f82
Packit 228f82
#include <check.h>
Packit 228f82
#include <glib.h>
Packit 228f82
Packit 228f82
#include "../lasso/lasso.h"
Packit 228f82
#include "../lasso/utils.h"
Packit 228f82
#include "../lasso/backward_comp.h"
Packit 228f82
#include "../lasso/xml/saml-2.0/saml2_xsd.h"
Packit 228f82
#include "../bindings/ghashtable.h"
Packit 228f82
Packit 228f82
#include "tests.h"
Packit 228f82
Packit 228f82
inline static char*
Packit 228f82
generateIdentityProviderContextDump()
Packit 228f82
{
Packit 228f82
	LassoServer *serverContext;
Packit 228f82
	GList *providers;
Packit 228f82
	char *ret;
Packit 228f82
Packit 228f82
	serverContext = lasso_server_new(
Packit 228f82
			TESTSDATADIR "/idp6-saml2/metadata.xml",
Packit 228f82
			TESTSDATADIR "/idp6-saml2/private-key.pem",
Packit 228f82
			NULL, /* Secret key to unlock private key */
Packit 228f82
			NULL);
Packit 228f82
	lasso_server_add_provider(
Packit 228f82
			serverContext,
Packit 228f82
			LASSO_PROVIDER_ROLE_SP,
Packit 228f82
			TESTSDATADIR "/sp5-saml2/metadata.xml",
Packit 228f82
			NULL,
Packit 228f82
			NULL);
Packit 228f82
	providers = g_hash_table_get_values(serverContext->providers);
Packit 228f82
	lasso_provider_set_encryption_mode(LASSO_PROVIDER(providers->data), LASSO_ENCRYPTION_MODE_ASSERTION | LASSO_ENCRYPTION_MODE_NAMEID);
Packit 228f82
	ret = lasso_server_dump(serverContext);
Packit 228f82
Packit 228f82
	g_object_unref(serverContext);
Packit 228f82
Packit 228f82
	return ret;
Packit 228f82
}
Packit 228f82
Packit 228f82
inline static char*
Packit 228f82
generateServiceProviderContextDump()
Packit 228f82
{
Packit 228f82
	LassoServer *serverContext;
Packit 228f82
	char *ret;
Packit 228f82
Packit 228f82
	serverContext = lasso_server_new(
Packit 228f82
			TESTSDATADIR "/sp5-saml2/metadata.xml",
Packit 228f82
			TESTSDATADIR "/sp5-saml2/private-key.pem",
Packit 228f82
			NULL, /* Secret key to unlock private key */
Packit 228f82
			NULL);
Packit 228f82
	lasso_server_add_provider(
Packit 228f82
			serverContext,
Packit 228f82
			LASSO_PROVIDER_ROLE_IDP,
Packit 228f82
			TESTSDATADIR "/idp6-saml2/metadata.xml",
Packit 228f82
			NULL,
Packit 228f82
			NULL);
Packit 228f82
Packit 228f82
	ret = lasso_server_dump(serverContext);
Packit 228f82
	g_object_unref(serverContext);
Packit 228f82
	return ret;
Packit 228f82
}
Packit 228f82
Packit 228f82
Suite*
Packit 228f82
assertion_query_suite()
Packit 228f82
{
Packit 228f82
	Suite *s = suite_create("Assertion Query");
Packit 228f82
	TCase *tc_metadata_access = tcase_create("Extended metadata access");
Packit 228f82
	suite_add_tcase(s, tc_metadata_access);
Packit 228f82
Packit 228f82
	return s;
Packit 228f82
}