Example #1
0
/**
 * lasso_login_assertion_add_discovery:
 * @login: a #LassoLogin object
 * @assertion: a #LassoSamlAssertion object
 *
 * Adds AttributeStatement and ResourceOffering attributes to @assertion of a @login object if there
 * is a discovery service registerered in the @LassoLogin.server field.
 * .
 **/
void
lasso_login_assertion_add_discovery(LassoLogin *login, LassoSamlAssertion *assertion)
{
	LassoProfile *profile = LASSO_PROFILE(login);
	LassoDiscoResourceOffering *resourceOffering;
	LassoDiscoServiceInstance *serviceInstance, *newServiceInstance;
	LassoSamlAttributeStatement *attributeStatement;
	LassoSamlAttribute *attribute;
	LassoSamlAttributeValue *attributeValue;

	serviceInstance = lasso_server_get_service(profile->server, LASSO_DISCO_HREF);
	if (LASSO_IS_DISCO_SERVICE_INSTANCE(serviceInstance) &&
			login->private_data->resourceId) {
		newServiceInstance = lasso_disco_service_instance_copy(serviceInstance);

		resourceOffering = lasso_disco_resource_offering_new(newServiceInstance);
		lasso_release_gobject(newServiceInstance);
		lasso_assign_gobject(resourceOffering->ResourceID, login->private_data->resourceId);

		attributeValue = lasso_saml_attribute_value_new();
		lasso_list_add_new_gobject(attributeValue->any, resourceOffering);

		attribute = lasso_saml_attribute_new();
		lasso_assign_string(attribute->attributeName, "DiscoveryResourceOffering");
		lasso_assign_string(attribute->attributeNameSpace, LASSO_DISCO_HREF);
		lasso_list_add_new_gobject(attribute->AttributeValue, attributeValue);

		attributeStatement = lasso_saml_attribute_statement_new();
		lasso_list_add_new_gobject(attributeStatement->Attribute, attribute);

		lasso_assign_new_gobject(assertion->AttributeStatement, attributeStatement);

		/* FIXME: Add CredentialsRef and saml:Advice Assertions */
	}
}
Example #2
0
LassoDiscoResourceOffering*
lasso_disco_resource_offering_new(LassoDiscoServiceInstance *serviceInstance)
{
	LassoDiscoResourceOffering *resource;

	g_return_val_if_fail(LASSO_IS_DISCO_SERVICE_INSTANCE(serviceInstance), NULL);

	resource = g_object_new(LASSO_TYPE_DISCO_RESOURCE_OFFERING, NULL);
	lasso_assign_gobject(resource->ServiceInstance, serviceInstance);

	return resource;
}
Example #3
0
/**
 * lasso_server_add_service:
 * @server: a #LassoServer
 * @service: a #LassoNode object implementing representing a service endpoint.
 *
 * Add a service to the registry of service of this #LassoServer object.
 *
 * Return value: 0 on success; a negative value if an error occured.
 **/
gint
lasso_server_add_service(LassoServer *server, LassoNode *service)
{
	g_return_val_if_fail(LASSO_IS_SERVER(server), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
	g_return_val_if_fail(service != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);

	if (LASSO_IS_DISCO_SERVICE_INSTANCE(service)) {
		g_hash_table_insert(server->services,
				g_strdup(LASSO_DISCO_SERVICE_INSTANCE(service)->ServiceType),
				g_object_ref(service));
	} else if (LASSO_IS_IDWSF2_DISCO_SVC_METADATA(service)) {
		return lasso_server_add_svc_metadata(server,
				LASSO_IDWSF2_DISCO_SVC_METADATA(service));
	} else {
		return LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ;
	}
	return 0;
}