Add function to set protocol conformance

Lasso uses an internal private variable bound to the provider to
indicate which protocol the provider is servicing. It is vital this
value be correctly set because many Lasso routines used it to dispatch
to the appropriate protocol handlers.

Normally the provider's protocol conformance is set as a side-effect
of parsing the XML metadata that describes the provider (e.g. an SP or
IdP). However there are some providers (e.g. an ECP client) which do
not have metadata. For providers lacking metadata it is essential
there be a mechanism to set the protocol conformance otherwise the
library will malfunction.

The function comes with documentation that includes a clear warning
this is to be used only in limited circumstances.

Signed-off-by: John Dennis <jdennis@redhat.com>
License: MIT
This commit is contained in:
John Dennis 2015-05-28 12:42:52 -04:00 committed by Benjamin Dauvergne
parent 1c31736ded
commit 4544ea9e9d
3 changed files with 30 additions and 0 deletions

View File

@ -169,6 +169,7 @@ lasso_provider_get_metadata_list_for_role
lasso_provider_get_metadata_keys_for_role
lasso_provider_get_roles
lasso_provider_match_conformance
lasso_provider_set_protocol_conformance
<SUBSECTION Standard>
LASSO_PROVIDER
LASSO_IS_PROVIDER

View File

@ -969,6 +969,32 @@ lasso_provider_get_protocol_conformance(const LassoProvider *provider)
return provider->private_data->conformance;
}
/**
* lasso_provider_set_protocol_conformance:
* @provider: a #LassoProvider object
* @protocol_conformance: #LassoProtocolConformance enumerated value.
*
* Normally the protocol conformance is set when the metadata for the
* provider is loaded because the metadata defines the type of
* server. However some #LassoServer variants do not have metadata
* (e.g. ECP) therefore instead of loading the metadata it is
* necessary to explicitly set the protocol conformance because parts
* of the Lasso library dispatch based on the protocol conformance.
* Without the protocol conformance being set it is likely the wrong
* code will execute.
*
* **WARNING**, do not manually set the protocol conformance if
* metadata has been loaded, metadata is the final arbiter of protocol
* conformance.
*
* Return value: 0 on success; another value if an error occured.
**/
void
lasso_provider_set_protocol_conformance(LassoProvider *provider, LassoProtocolConformance protocol_conformance)
{
provider->private_data->conformance = protocol_conformance;
}
gboolean
_lasso_provider_load_metadata_from_buffer(LassoProvider *provider, const gchar *metadata, int length)
{

View File

@ -236,6 +236,9 @@ LASSO_EXPORT xmlNode* lasso_provider_get_organization(const LassoProvider *provi
LASSO_EXPORT LassoProtocolConformance lasso_provider_get_protocol_conformance(
const LassoProvider *provider);
LASSO_EXPORT void lasso_provider_set_protocol_conformance(LassoProvider *provider,
LassoProtocolConformance protocol_conformance);
LASSO_EXPORT void lasso_provider_set_encryption_mode(LassoProvider *provider,
LassoEncryptionMode encryption_mode);