Projet

Général

Profil

lasso_saml20_provider_get_first_http_method.diff

Benjamin Dauvergne, 17 mars 2012 13:58

Télécharger (2,04 ko)

Voir les différences:


  

lasso/saml-2.0/provider.c
534 534
	return TRUE;
535 535
}
536 536

  
537
static gboolean has_synchronous_methods(LassoProvider *provider, LassoMdProtocolType protocol_type)
537
enum {
538
	FOR_RESPONSE = 1
539
};
540

  
541
/**
542
 * has_synchronous_methods:
543
 * @provider: a #LassoProvider object
544
 * @protocol_type: a #LassoMdProtocolType value
545
 * @for_response: a boolean stating whether we need the answer for receiving a response.
546
 *
547
 * Return whether the given @provider support a certain protocol with a synchronous binding.
548
 * If we need to receive a response for this protocol, @for_response must be set to True.
549
 *
550
 * Return result: TRUE if @provider supports @protocol_type with a synchronous binding, eventually
551
 * for receiving responses, FALSE otherwise.
552
 */
553
static gboolean has_synchronous_methods(LassoProvider *provider, LassoMdProtocolType protocol_type,
554
		gboolean for_response)
538 555
{
539 556
	GList *t = NULL;
540 557
	const char *kind = NULL;
......
547 564
		return LASSO_HTTP_METHOD_NONE;
548 565
	}
549 566

  
567
	if (for_response && protocol_type == LASSO_MD_PROTOCOL_TYPE_SINGLE_SIGN_ON)
568
	{
569
		kind = LASSO_SAML2_METADATA_ELEMENT_ASSERTION_CONSUMER_SERVICE;
570
	}
571

  
550 572
	lasso_foreach(t, provider->private_data->endpoints) {
551 573
		EndpointType *endpoint_type = (EndpointType*)t->data;
552 574
		if (endpoint_type && lasso_strisequal(endpoint_type->kind, kind)) {
......
581 603
			/* a synchronous method needs another synchronous method for receiving the
582 604
			 * response on the local side */
583 605
			if (http_method_kind(result) == SYNCHRONOUS
584
					&& ! has_synchronous_methods(provider, protocol_type))
606
					&& ! has_synchronous_methods(provider, protocol_type, FOR_RESPONSE))
585 607
				continue;
586 608
			if (result != LASSO_HTTP_METHOD_NONE)
587 609
				break;