LassoDiscovery

LassoDiscovery — ID-WSF Discovery Service Profile

Synopsis


#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,
                                                         const gchar *service_type,
                                                         const gchar *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,
                                                         const char *service_type);
GList*              lasso_discovery_get_services        (LassoDiscovery *discovery);
gint                lasso_discovery_init_insert         (LassoDiscovery *discovery,
                                                         LassoDiscoResourceOffering *new_offering,
                                                         const char *security_mech_id);
gint                lasso_discovery_init_query          (LassoDiscovery *discovery,
                                                         const gchar *security_mech_id);
gint                lasso_discovery_init_remove         (LassoDiscovery *discovery,
                                                         const char *entry_id);
gint                lasso_discovery_process_modify_msg  (LassoDiscovery *discovery,
                                                         const gchar *message,
                                                         const gchar *security_mech_id);
gint                lasso_discovery_process_modify_response_msg
                                                        (LassoDiscovery *discovery,
                                                         const gchar *message);
gint                lasso_discovery_process_query_msg   (LassoDiscovery *discovery,
                                                         const gchar *message,
                                                         const char *security_mech_id);
gint                lasso_discovery_process_query_response_msg
                                                        (LassoDiscovery *discovery,
                                                         const gchar *message);

Description

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);

Details

LassoDiscovery

typedef struct {
	LassoWsfProfile parent;

	LassoDiscoResourceID *resource_id;
	LassoDiscoEncryptedResourceID *encrypted_resource_id;
} LassoDiscovery;


lasso_discovery_new ()

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.

lasso_discovery_destroy ()

void                lasso_discovery_destroy             (LassoDiscovery *discovery);

Destroys LassoDiscovery objects created with lasso_discovery_new() or lasso_discovery_new_from_dump().

discovery : a LassoDiscovery

lasso_discovery_add_requested_service_type ()

LassoDiscoRequestedServiceType* lasso_discovery_add_requested_service_type
                                                        (LassoDiscovery *discovery,
                                                         const gchar *service_type,
                                                         const gchar *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 LassoDiscoRequestedServiceType with the request. Note that it is internally allocated and shouldn't be freed by the caller.

lasso_discovery_build_modify_response_msg ()

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.

lasso_discovery_build_response_msg ()

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.

lasso_discovery_get_service ()

LassoDataService*   lasso_discovery_get_service         (LassoDiscovery *discovery,
                                                         const char *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.

lasso_discovery_get_services ()

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.

lasso_discovery_init_insert ()

gint                lasso_discovery_init_insert         (LassoDiscovery *discovery,
                                                         LassoDiscoResourceOffering *new_offering,
                                                         const char *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.

lasso_discovery_init_query ()

gint                lasso_discovery_init_query          (LassoDiscovery *discovery,
                                                         const gchar *security_mech_id);

Initializes a disco:Query message.

discovery : a LassoDiscovery
security_mech_id :
Returns : 0 on success; or a negative value otherwise.

lasso_discovery_init_remove ()

gint                lasso_discovery_init_remove         (LassoDiscovery *discovery,
                                                         const char *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.

lasso_discovery_process_modify_msg ()

gint                lasso_discovery_process_modify_msg  (LassoDiscovery *discovery,
                                                         const gchar *message,
                                                         const gchar *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.

lasso_discovery_process_modify_response_msg ()

gint                lasso_discovery_process_modify_response_msg
                                                        (LassoDiscovery *discovery,
                                                         const gchar *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.

lasso_discovery_process_query_msg ()

gint                lasso_discovery_process_query_msg   (LassoDiscovery *discovery,
                                                         const gchar *message,
                                                         const char *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.

lasso_discovery_process_query_response_msg ()

gint                lasso_discovery_process_query_response_msg
                                                        (LassoDiscovery *discovery,
                                                         const gchar *message);

Processes a disco:QueryResponse message.

discovery : a LassoDiscovery
message : the disco:QueryResponse message
Returns : 0 on success; or a negative value otherwise.