## LassoNameRegistration

LassoNameRegistration — Name Registration Profile (ID-FF)

## Functions

LassoNameRegistration * | lasso_name_registration_new ()
LassoNameRegistration * | lasso_name_registration_new_from_dump ()
lasso_error_t | lasso_name_registration_build_request_msg ()
lasso_error_t | lasso_name_registration_build_response_msg ()
void | lasso_name_registration_destroy ()
gchar * | lasso_name_registration_dump ()
lasso_error_t | lasso_name_registration_init_request ()
lasso_error_t | lasso_name_registration_process_request_msg ()
lasso_error_t | lasso_name_registration_process_response_msg ()
lasso_error_t | lasso_name_registration_validate_request ()

## Types and Values

struct | LassoNameRegistration

## Object Hierarchy

        GObject
        ╰── LassoNode
            ╰── LassoProfile
                ╰── LassoNameRegistration

## Description

## Functions

### lasso_name_registration_new ()

    LassoNameRegistration *
    lasso_name_registration_new (LassoServer *server);

Creates a new LassoNameRegistration.

#### Parameters

server | the LassoServer |

#### Returns

a newly created LassoNameRegistration object; or NULL if an error occured

### lasso_name_registration_new_from_dump ()

    LassoNameRegistration *
    lasso_name_registration_new_from_dump (LassoServer *server,
                                           const char *dump);

Restores the `dump` to a new LassoNameRegistration.

#### Parameters

server | the LassoServer |
dump | XML logout dump |

#### Returns

a newly created LassoNameRegistration; or NULL if an error occured

### lasso_name_registration_build_request_msg ()

    lasso_error_t
    lasso_name_registration_build_request_msg
                                   (LassoNameRegistration *name_registration);

Builds a register name identifier request message.

It gets the register name identifier protocol profile and:

- if it is a SOAP method, then it builds the register name identifier request SOAP message, optionally signs his node, sets `msg_body`, gets the SoapEndpoint url and sets `msg_url`.

- if it is a HTTP-Redirect method, then it builds the register name identifier request QUERY message (optionally signs the request message), builds the request url with register name identifier url with register name identifier service url, sets `msg_url` in the register name identifier object, sets `msg_body` to NULL.

#### Parameters

name_registration | a LassoNameRegistration |

#### Returns

0 on success; or a negative value otherwise.

### lasso_name_registration_build_response_msg ()

    lasso_error_t
    lasso_name_registration_build_response_msg
                                   (LassoNameRegistration *name_registration);

Builds the register name idendifier response message.

It gets the request message method and:

- if it is a SOAP method, then it builds the response SOAP message, sets the msg_body attribute, gets the register name identifier service return url and sets `msg_url` of the object.

- if it is a HTTP-Redirect method, then it builds the response QUERY message, builds the response url, sets `msg_url` with the response url and sets the msg_body with NULL

If private key and certificate are set in server object it will also signs the message (either with X509 if SOAP or with a simple signature for query strings).

#### Parameters

name_registration | a LassoNameRegistration |

#### Returns

0 on success; or a negative value otherwise.

### lasso_name_registration_destroy ()

    void
    lasso_name_registration_destroy (LassoNameRegistration *name_registration);

Destroys a LassoNameRegistration object.

#### Parameters

name_registration | a LassoNameRegistration |

### lasso_name_registration_dump ()

    gchar *
    lasso_name_registration_dump (LassoNameRegistration *name_registration);

Dumps `name_registration` content to an XML string.

#### Parameters

name_registration | a LassoNameRegistration |

#### Returns

the dump string. It must be freed by the caller.

[transfer full]

### lasso_name_registration_init_request ()

    lasso_error_t
    lasso_name_registration_init_request (LassoNameRegistration *name_registration,
                                          char *remote_providerID,
                                          LassoHttpMethod http_method);

Initializes a new lib:RegisterNameIdentifierRequest request; it sets `name_registration->nameIdentifier` to the new name identifier and `name_registration->oldNameIdentifier` to the old one.

#### Parameters

name_registration | a LassoNameRegistration |
remote_providerID | the providerID of the identity provider. |
http_method | if set, then it get the protocol profile in metadata corresponding of this HTTP request method. |

#### Returns

0 on success; or a negative value otherwise.

### lasso_name_registration_process_request_msg ()

    lasso_error_t
    lasso_name_registration_process_request_msg
                                   (LassoNameRegistration *name_registration,
                                    gchar *request_msg);

Processes a lib:RegisterNameIdentifierRequest message. Rebuilds a request object from the message and optionally verifies its signature. Sets profile->nameIdentifier to local name identifier. If it changed (when this is IdP-initiated and there was no previously defined local name identifier) profile->nameIdentifier will be the new one and profile->oldNameIdentiifer the old one.

#### Parameters

name_registration | a LassoNameRegistration |
request_msg | the register name identifier request message |

#### Returns

0 on success; or a negative value otherwise.

### lasso_name_registration_process_response_msg ()

    lasso_error_t
    lasso_name_registration_process_response_msg
                                   (LassoNameRegistration *name_registration,
                                    gchar *response_msg);

Processes a lib:RegisterNameIdentifierResponse message. Rebuilds a response object from the message and optionally verifies its signature.

If the response depicts Success it will also update Principal federation.

#### Parameters

name_registration | a LassoNameRegistration |
response_msg | the register name identifier response message |

#### Returns

0 on success; or a negative value otherwise.

### lasso_name_registration_validate_request ()

    lasso_error_t
    lasso_name_registration_validate_request
                                   (LassoNameRegistration *name_registration);

Checks profile request with regards to message status and principal federations, update them accordingly and prepares a lib:RegisterNameIdentifierResponse accordingly.

#### Parameters

name_registration | a LassoNameRegistration |

#### Returns

0 on success; or a negative value otherwise.

## Types and Values

### struct LassoNameRegistration

    struct LassoNameRegistration {
    	LassoSamlNameIdentifier *oldNameIdentifier;
    };