Add server utility lasso_server_get_endpoint_url_by_id()

Locate the provider in the server's list of providers, then select an
endpoint given the @endpoint_description and return that endpoint's URL.
If the provider cannot be found or if the provider does not have a
matching endpoint NULL will be returned.

Signed-off-by: John Dennis <jdennis@redhat.com>
License: MIT
This commit is contained in:
John Dennis 2015-05-28 09:26:35 -04:00 committed by Benjamin Dauvergne
parent 41d771c628
commit 237b7424bd
3 changed files with 32 additions and 0 deletions

View File

@ -20,6 +20,7 @@ lasso_server_get_provider
lasso_server_set_encryption_private_key
lasso_server_set_encryption_private_key_with_password
lasso_server_load_affiliation
lasso_server_get_endpoint_url_by_id
lasso_server_saml2_assertion_setup_signature
<SUBSECTION Standard>
LASSO_SERVER

View File

@ -254,6 +254,34 @@ cleanup:
return rc;
}
/**
* lasso_server_get_endpoint_url_by_id:
* @server: a #LassoServer
* @provider_id: the EntityID whose endpoints will be examined.
* @endpoint_description: string describing criteria used to select endpoint.
*
* Locate the provider in the server's list of providers, then select an
* endpoint given the @endpoint_description and return than endpoint's URL.
* If the provider cannot be found or if the provider does not have a
* matching endpoint NULL will be returned.
*
* Returns: url (must be freed by caller)
*/
gchar *
lasso_server_get_endpoint_url_by_id(const LassoServer *server, const gchar *provider_id,
const gchar *endpoint_description)
{
LassoProvider *provider;
gchar *url = NULL;
provider = lasso_server_get_provider(server, provider_id);
if (!provider) return NULL;
url = lasso_provider_get_metadata_one(provider, endpoint_description);
return url;
}
/*****************************************************************************/
/* private methods */
/*****************************************************************************/

View File

@ -127,6 +127,9 @@ LASSO_EXPORT lasso_error_t lasso_server_load_metadata(LassoServer *server, Lasso
LASSO_EXPORT lasso_error_t lasso_server_add_provider2(LassoServer *server, LassoProvider *provider);
LASSO_EXPORT gchar *lasso_server_get_endpoint_url_by_id(const LassoServer *server,
const gchar *provider_id, const gchar *endpoint_description);
#ifdef __cplusplus
}
#endif /* __cplusplus */