/* $Id$ * * Lasso - A free implementation of the Liberty Alliance specifications. * * Copyright (C) 2004 Entr'ouvert * http://lasso.entrouvert.org * * Authors: Nicolas Clapies * Valery Febvre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include /* The is defined as an extension of samlp:RequestAbstractType. The RequestID attribute in samlp:RequestAbstractType has uniqueness requirements placed on it by [SAMLCore11], which require it to have the properties of a nonce. Schema fragment (liberty-idff-protocols-schema-v1.2.xsd): From liberty-metadata-v1.0.xsd: */ /*****************************************************************************/ /* public methods */ /*****************************************************************************/ void lasso_lib_authn_request_set_affiliationID(LassoLibAuthnRequest *node, const xmlChar *affiliationID) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(affiliationID != NULL); /* FIXME : affiliationID lenght SHOULD be <= 1024 */ LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->new_child(LASSO_NODE (node), "AffiliationID", affiliationID, FALSE); } void lasso_lib_authn_request_set_assertionConsumerServiceID(LassoLibAuthnRequest *node, const xmlChar *assertionConsumerServiceID) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(assertionConsumerServiceID != NULL); LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->new_child(LASSO_NODE (node), "AssertionConsumerServiceID", assertionConsumerServiceID, FALSE); } void lasso_lib_authn_request_set_consent(LassoLibAuthnRequest *node, const xmlChar *consent) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(consent != NULL); LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->set_prop(LASSO_NODE (node), "consent", consent); } void lasso_lib_authn_request_set_forceAuthn(LassoLibAuthnRequest *node, gboolean forceAuthn) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(forceAuthn == FALSE || forceAuthn == TRUE); LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); if (forceAuthn == FALSE) { class->new_child(LASSO_NODE (node), "ForceAuthn", "false", FALSE); } if (forceAuthn == TRUE) { class->new_child(LASSO_NODE (node), "ForceAuthn", "true", FALSE); } } void lasso_lib_authn_request_set_isPassive(LassoLibAuthnRequest *node, gboolean isPassive) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(isPassive == FALSE || isPassive == TRUE); LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); if (isPassive == FALSE) { class->new_child(LASSO_NODE (node), "IsPassive", "false", FALSE); } if (isPassive == TRUE) { class->new_child(LASSO_NODE (node), "IsPassive", "true", FALSE); } } /** * lasso_lib_authn_request_set_nameIDPolicy: * @node: the pointer to node * @nameIDPolicy: the value of "NameIDPolicy" attribute. * * Sets the "NameIDPolicy" attribute. It's an enumeration permitting requester * influence over name identifier policy at the identity provider. **/ void lasso_lib_authn_request_set_nameIDPolicy(LassoLibAuthnRequest *node, const xmlChar *nameIDPolicy) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(nameIDPolicy != NULL); LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->new_child(LASSO_NODE (node), "NameIDPolicy", nameIDPolicy, FALSE); } void lasso_lib_authn_request_set_protocolProfile(LassoLibAuthnRequest *node, const xmlChar *protocolProfile) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(protocolProfile != NULL); LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->new_child(LASSO_NODE (node), "ProtocolProfile", protocolProfile, FALSE); } void lasso_lib_authn_request_set_providerID(LassoLibAuthnRequest *node, const xmlChar *providerID) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(providerID != NULL); /* FIXME : providerID lenght SHOULD be <= 1024 */ LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE); } void lasso_lib_authn_request_set_relayState(LassoLibAuthnRequest *node, const xmlChar *relayState) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(relayState != NULL); /* FIXME : RelayState lenght SHOULD be <= 80 */ LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->new_child(LASSO_NODE (node), "RelayState", relayState, FALSE); } void lasso_lib_authn_request_set_requestAuthnContext(LassoLibAuthnRequest *node, LassoLibRequestAuthnContext *requestAuthnContext) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(LASSO_IS_LIB_REQUEST_AUTHN_CONTEXT(requestAuthnContext)); LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->add_child(LASSO_NODE (node), LASSO_NODE (requestAuthnContext), FALSE); } /** * lasso_lib_authn_request_set_scoping: * @node: the pointer to node object * @scoping: the pointer to node object * * Sets the "Scoping" element. **/ void lasso_lib_authn_request_set_scoping(LassoLibAuthnRequest *node, LassoLibScoping *scoping) { g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node)); g_assert(LASSO_IS_LIB_SCOPING(scoping)); LassoNodeClass *class = LASSO_NODE_GET_CLASS(node); class->add_child(LASSO_NODE (node), LASSO_NODE (scoping), FALSE); } /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ static void lasso_lib_authn_request_instance_init(LassoLibAuthnRequest *node) { LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node)); class->set_ns(LASSO_NODE(node), lassoLibHRef, lassoLibPrefix); class->set_name(LASSO_NODE(node), "AuthnRequest"); } static void lasso_lib_authn_request_class_init(LassoLibAuthnRequestClass *klass) { } GType lasso_lib_authn_request_get_type() { static GType this_type = 0; if (!this_type) { static const GTypeInfo this_info = { sizeof (LassoLibAuthnRequestClass), NULL, NULL, (GClassInitFunc) lasso_lib_authn_request_class_init, NULL, NULL, sizeof(LassoLibAuthnRequest), 0, (GInstanceInitFunc) lasso_lib_authn_request_instance_init, }; this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT, "LassoLibAuthnRequest", &this_info, 0); } return this_type; } LassoNode* lasso_lib_authn_request_new() { return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_AUTHN_REQUEST, NULL)); }