## Utility functions for ID-WSF 1.0

Utility functions for ID-WSF 1.0 — Misc functions used in the implementation of ID-WSF 1.0

## Stability Level

Private, unless otherwise indicated

## Functions

gboolean | lasso_security_mech_id_is_null_authentication ()
gboolean | lasso_security_mech_id_is_x509_authentication ()
gboolean | lasso_security_mech_id_is_saml_authentication ()
gboolean | lasso_security_mech_id_is_bearer_authentication ()
lasso_error_t | lasso_login_set_encryptedResourceId ()
lasso_error_t | lasso_login_set_resourceId ()
LassoDiscoServiceInstance * | lasso_server_get_service ()
lasso_error_t | lasso_server_add_service ()
lasso_error_t | lasso_server_add_service_from_dump ()
lasso_error_t | lasso_identity_add_resource_offering ()
gboolean | lasso_identity_remove_resource_offering ()
GList * | lasso_identity_get_offerings ()
LassoDiscoResourceOffering * | lasso_identity_get_resource_offering ()
LassoSoapBindingProvider * | lasso_soap_binding_get_provider ()
LassoSoapBindingCorrelation * | lasso_soap_binding_get_correlation ()
void | lasso_register_dst_service ()
char * | lasso_get_prefix_for_dst_service_href ()

## Description

## Functions

### lasso_security_mech_id_is_null_authentication ()

    gboolean
    lasso_security_mech_id_is_null_authentication
                                   (const gchar *security_mech_id);

#### Parameters

security_mech_id | the URI of an authentication mechanism |

#### Returns

`TRUE` if `security_mech_id` is null or one of urn:liberty:security:2003-08:null:null, urn:liberty:security:2003-08:TLS:null, urn:liberty:security:2003-08:ClientTLS:null, FALSE otherwise.

### lasso_security_mech_id_is_x509_authentication ()

    gboolean
    lasso_security_mech_id_is_x509_authentication
                                   (const gchar *security_mech_id);

#### Parameters

security_mech_id | the URI of an authentication mechanism |

#### Returns

`TRUE` if `security_mech_id` is one of urn:liberty:security:2003-08:null:X509, urn:liberty:security:2003-08:TLS:X509, urn:liberty:security:2003-08:ClientTLS:X509, FALSE otherwise.

### lasso_security_mech_id_is_saml_authentication ()

    gboolean
    lasso_security_mech_id_is_saml_authentication
                                   (const gchar *security_mech_id);

#### Parameters

security_mech_id | the URI of an authentication mechanism |

#### Returns

`TRUE` if `security_mech_id` is one of urn:liberty:security:2003-08:null:SAML, urn:liberty:security:2003-08:TLS:SAML, urn:liberty:security:2003-08:ClientTLS:SAML, urn:liberty:security:2005-02:null:SAML, urn:liberty:security:2005-02:TLS:SAML, FALSE otherwise.

### lasso_security_mech_id_is_bearer_authentication ()

    gboolean
    lasso_security_mech_id_is_bearer_authentication
                                   (const gchar *security_mech_id);

#### Parameters

security_mech_id | the URI of an authentication mechanism |

#### Returns

`TRUE` if `security_mech_id` is one of urn:liberty:security:2003-08:null:Bearer, urn:liberty:security:2003-08:TLS:Bearer, urn:liberty:security:2003-08:ClientTLS:Bearer, urn:liberty:security:2005-02:null:Bearer, urn:liberty:security:2005-02:TLS:Bearer, FALSE otherwise.

### lasso_login_set_encryptedResourceId ()

    lasso_error_t
    lasso_login_set_encryptedResourceId (LassoLogin *login,
                                         LassoDiscoEncryptedResourceID *encryptedResourceId);

Set the LassoDiscoEncryptedResourceID to place the next produced assertions as an ID-WSF 1.0 bootstrap.

#### Parameters

login | a LassoLogin object |
encryptedResourceId | the LassoDiscoEncryptedResourceID to setup in the login object |

#### Returns

0 on success; or a negative value otherwise.

### lasso_login_set_resourceId ()

    lasso_error_t
    lasso_login_set_resourceId (LassoLogin *login,
                                const char *content);

Set the resourceId to place in the next produced assertion for ID-WSF bootstrap.

#### Parameters

login | a LassoLogin |
content | a resourceID identifier |

#### Returns

0 on success; or a negative value otherwise.

### lasso_server_get_service ()

    LassoDiscoServiceInstance *
    lasso_server_get_service (LassoServer *server,
                              const gchar *serviceType);

Look up a disco service instance corresponding to this service type.

#### Parameters

server | a LassoServer |
serviceType | the service type |

#### Returns

the LassoDiscoServiceInstance, NULL if it was not found. The LassoDiscoServiceInstance is owned by Lasso and should not be freed.

[transfer none][allow-none]

### lasso_server_add_service ()

    lasso_error_t
    lasso_server_add_service (LassoServer *server,
                              LassoNode *service);

Add a service to the registry of service of this LassoServer object.

#### Parameters

server | a LassoServer |
service | a LassoNode object implementing representing a service endpoint. |

#### Returns

0 on success; a negative value if an error occured.

### lasso_server_add_service_from_dump ()

    lasso_error_t
    lasso_server_add_service_from_dump (LassoServer *server,
                                        const gchar *dump);

An utility function that parse a LassoNode dump an try to add it as a service using lasso_server_add_service.

#### Parameters

server | a LassoServer |
dump | the XML dump of a LassoNode representing a service endpoint. |

#### Returns

0 if succesfull, LASSO_PARAM_ERROR_BAD_TYPE_OF_NULL_OBJECT if said dump is not a LassoNode or is not of the righ type, LASSO_PARAM_ERROR_INVALID_VALUE if dump is NULL.

### lasso_identity_add_resource_offering ()

    lasso_error_t
    lasso_identity_add_resource_offering (LassoIdentity *identity,
                                          LassoDiscoResourceOffering *offering);

Add a new offering to the identity object to be retrieved later by `lasso_identity_get_offerings()` or `lasso_identity_get_resource_offering()`. It also allocate an entryId identifier for the offering, look into offering->entryID to get it after this call.

#### Parameters

identity | a LassoIdentity object |
offering | a LassoDiscoResourceOffering object to add |

#### Returns

Always 0, there should not be any error (if memory is not exhausted).

### lasso_identity_remove_resource_offering ()

    gboolean
    lasso_identity_remove_resource_offering
                                   (LassoIdentity *identity,
                                    const char *entryID);

Remove resource offering about identity with `entryID`

#### Parameters

identity | a LassoIdentity |
entryID | the resource offering entry ID |

#### Returns

TRUE on success; FALSE if the offering was not found.

### lasso_identity_get_offerings ()

    GList *
    lasso_identity_get_offerings (LassoIdentity *identity,
                                  const char *service_type);

Returns a list of LassoDiscoResourceOffering associated to this service type.

#### Parameters

identity | a LassoIdentity |
service_type | a char* string representing the type of service we are looking for |

#### Returns

a newly allocated list of LassoDiscoResourceOffering.

[transfer full][element-type LassoDiscoResourceOffering]

### lasso_identity_get_resource_offering ()

    LassoDiscoResourceOffering *
    lasso_identity_get_resource_offering (LassoIdentity *identity,
                                          const char *entryID);

### lasso_soap_binding_get_provider ()

    LassoSoapBindingProvider *
    lasso_soap_binding_get_provider (LassoSoapEnvelope *envelope);

Look up the sb:Provider header in the SOAP message envelope.

#### Parameters

envelope | a LassoSoapEnvelope |

#### Returns

NULL if no Provider element is present in the header of the SOAP envelope. If found it returns a reference you do not own.

### lasso_soap_binding_get_correlation ()

    LassoSoapBindingCorrelation *
    lasso_soap_binding_get_correlation (LassoSoapEnvelope *evelope);

Look up the sb:Correlation header in the SOAP message envelope.

#### Parameters

envelope | a LassoSoapEnvelope |

#### Returns

NULL if no Correlation element is present in the header of the SOAP envelope. If found it returns a reference you do not own.

### lasso_register_dst_service ()

    void
    lasso_register_dst_service (const char *prefix,
                                const char *href);

Registers prefix and href of a custom data service template service.

#### Parameters

prefix | prefix of DST service |
href | href of DST service |

### lasso_get_prefix_for_dst_service_href ()

    char *
    lasso_get_prefix_for_dst_service_href (const char *href);