![]() |
![]() |
![]() |
Lasso Reference Manual | ![]() |
---|---|---|---|---|
#include <lasso/lasso.h> LassoDiscovery; LassoDiscovery* lasso_discovery_new (LassoServer *server);void lasso_discovery_destroy (LassoDiscovery *discovery);LassoDiscoRequestedServiceType * lasso_discovery_add_requested_service_type (LassoDiscovery *discovery, constgchar *service_type, constgchar *option);gint lasso_discovery_build_modify_response_msg (LassoDiscovery *discovery);gint lasso_discovery_build_response_msg (LassoDiscovery *discovery); LassoDataService* lasso_discovery_get_service (LassoDiscovery *discovery, constchar *service_type);GList * lasso_discovery_get_services (LassoDiscovery *discovery);gint lasso_discovery_init_insert (LassoDiscovery *discovery,LassoDiscoResourceOffering *new_offering, constchar *security_mech_id);gint lasso_discovery_init_query (LassoDiscovery *discovery, constgchar *security_mech_id);gint lasso_discovery_init_remove (LassoDiscovery *discovery, constchar *entry_id);gint lasso_discovery_process_modify_msg (LassoDiscovery *discovery, constgchar *message, constgchar *security_mech_id);gint lasso_discovery_process_modify_response_msg (LassoDiscovery *discovery, constgchar *message);gint lasso_discovery_process_query_msg (LassoDiscovery *discovery, constgchar *message, constchar *security_mech_id);gint lasso_discovery_process_query_response_msg (LassoDiscovery *discovery, constgchar *message);
The Discovery service usually runs on the principal identity provider and knowns about resources and services related to the principal. Attribute providers can register themselves as offering resources for an user while other services can ask where to find a given resource.
The following example is a service provider asking for a "PP" service (an attribute provider for the "Personal Profile"):
LassoServer *server; // initialized before char* session_dump; // initialized before LassoDiscovery *discovery; // discovery service char *soap_answer; // SOAP answer from disco service LassoProfileService *service; // instance to perform on requested service discovery = lasso_discovery_new(server); lasso_wsf_profile_set_session_from_dump(LASSO_WSF_PROFILE(discovery), session_dump); lasso_discovery_init_query(discovery); lasso_discovery_add_requested_service(discovery, LASSO_PP_HREF); lasso_discovery_build_request_msg(discovery); // service must perform SOAP call to LASSO_WSF_PROFILE(discovery)->msg_url // the SOAP message is LASSO_WSF_PROFILE(discovery)->msg_body. The answer // is stored in char* soap_answer; lasso_discovery_process_query_response_msg(discovery, soap_answer); service = lasso_discovery_get_service(discovery);
typedef struct { LassoWsfProfile parent; LassoDiscoResourceID *resource_id; LassoDiscoEncryptedResourceID *encrypted_resource_id; } LassoDiscovery;
LassoDiscovery* lasso_discovery_new (LassoServer *server);
Creates a new LassoDiscovery.
server : |
the LassoServer |
Returns : | a newly created LassoDiscovery object; or NULL if an error occured. |
void lasso_discovery_destroy (LassoDiscovery *discovery);
Destroys LassoDiscovery objects created with lasso_discovery_new()
or
lasso_discovery_new_from_dump()
discovery : |
a LassoDiscovery |
LassoDiscoRequestedServiceType * lasso_discovery_add_requested_service_type (LassoDiscovery *discovery, constgchar *service_type, constgchar *option);
Adds a request for service of service_type
to the disco:Query being built.
discovery : |
a LassoDiscovery |
service_type : |
requested service type |
option : |
option to the requested service |
Returns : | a newly created |
gint lasso_discovery_build_modify_response_msg (LassoDiscovery *discovery);
Builds a disco:ModifyResponse message; answer to the disco:Modify passed
to lasso_discovery_process_modify_msg()
. It inserts and removed
ResourceOfferings from identity; it must be saved afterwards.
Sets msg_body
to the SOAP answer.
discovery : |
a LassoDiscovery |
Returns : | 0 on success; or a negative value otherwise. |
gint lasso_discovery_build_response_msg (LassoDiscovery *discovery);
Builds a disco:QueryResponse message; answer to the disco:Query passed to
lasso_discovery_process_query_msg()
. It looks up resource offerings in the
principal identity and extracts those of the requested service type.
Sets msg_body
to the SOAP answer.
discovery : |
a LassoDiscovery |
Returns : | 0 on success; or a negative value otherwise. |
LassoDataService* lasso_discovery_get_service (LassoDiscovery *discovery, constchar *service_type);
After a disco:query message, creates a LassoDataService instance for the
requested service_type
.
discovery : |
a LassoDiscovery |
service_type : |
the requested service type |
Returns : | a newly created LassoDataService object; or NULL if an error occured. |
GList * lasso_discovery_get_services (LassoDiscovery *discovery);
After a disco:query message, creates a GList object of LassoDataService.
discovery : |
a LassoDiscovery |
Returns : | a newly created GList object of LassoDataService; or NULL if an error occured. |
gint lasso_discovery_init_insert (LassoDiscovery *discovery,LassoDiscoResourceOffering *new_offering, constchar *security_mech_id);
Initializes a disco Modify/InsertEntry
discovery : |
a LassoDiscovery |
new_offering : |
the new service offered |
security_mech_id : |
the security mechanism identifier |
Returns : | 0 on success; or a negative value otherwise. |
gint lasso_discovery_init_query (LassoDiscovery *discovery, constgchar *security_mech_id);
Initializes a disco:Query message.
discovery : |
a LassoDiscovery |
security_mech_id : |
|
Returns : | 0 on success; or a negative value otherwise. |
gint lasso_discovery_init_remove (LassoDiscovery *discovery, constchar *entry_id);
Initializes a disco Modify/RemoveEntry
discovery : |
a LassoDiscovery |
entry_id : |
entry id of the resource offering to remove |
Returns : | 0 on success; or a negative value otherwise. |
gint lasso_discovery_process_modify_msg (LassoDiscovery *discovery, constgchar *message, constgchar *security_mech_id);
Processes a disco:Modify SOAP message. Rebuilds a request object from the message and extracts ResourceID.
discovery : |
a LassoDiscovery |
message : |
the disco:Modify SOAP message |
security_mech_id : |
|
Returns : | 0 on success; or a negative value otherwise. |
gint lasso_discovery_process_modify_response_msg (LassoDiscovery *discovery, constgchar *message);
Processes a disco:ModifyResponse SOAP message.
discovery : |
a LassoDiscovery |
message : |
the disco:ModifyResponse SOAP message |
Returns : | 0 on success; or a negative value otherwise. |
gint lasso_discovery_process_query_msg (LassoDiscovery *discovery, constgchar *message, constchar *security_mech_id);
Processes a disco:Query SOAP message. Rebuilds a request object from the message and extracts ResourceID.
discovery : |
a LassoDiscovery |
message : |
the disco:Query SOAP message |
security_mech_id : |
|
Returns : | 0 on success; or a negative value otherwise. |
gint lasso_discovery_process_query_response_msg (LassoDiscovery *discovery, constgchar *message);
Processes a disco:QueryResponse message.
discovery : |
a LassoDiscovery |
message : |
the disco:QueryResponse message |
Returns : | 0 on success; or a negative value otherwise. |