diff options
| author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-04-22 12:48:39 +0000 |
|---|---|---|
| committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-04-22 12:48:39 +0000 |
| commit | fc877f8e48b4cf349f97deb3d070550a29d941e0 (patch) | |
| tree | a6567f30717b14efce129b356d4663e5420f8363 | |
| parent | a0fa9940fab12e048d192c101c1e5888ad9e0420 (diff) | |
| download | lasso-fc877f8e48b4cf349f97deb3d070550a29d941e0.tar.gz lasso-fc877f8e48b4cf349f97deb3d070550a29d941e0.tar.xz lasso-fc877f8e48b4cf349f97deb3d070550a29d941e0.zip | |
previously named ssoaf_authn_request.c and ssoaf_authn_request.h
| -rw-r--r-- | lasso/Attic/protocols/sso_and_federation_authn_request.c | 158 | ||||
| -rw-r--r-- | lasso/Attic/protocols/sso_and_federation_authn_request.h | 70 |
2 files changed, 228 insertions, 0 deletions
diff --git a/lasso/Attic/protocols/sso_and_federation_authn_request.c b/lasso/Attic/protocols/sso_and_federation_authn_request.c new file mode 100644 index 00000000..2129a670 --- /dev/null +++ b/lasso/Attic/protocols/sso_and_federation_authn_request.c @@ -0,0 +1,158 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.com> + * + * 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 <lasso/protocols/ssoaf_authn_request.h> + +/*****************************************************************************/ +/* public methods */ +/*****************************************************************************/ + +void +lasso_authn_request_set_requestAuthnContext(LassoAuthnRequest *request, + GPtrArray *authnContextClassRefs, + GPtrArray *authnContextStatementRefs, + const xmlChar *authnContextComparison) +{ + g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request)); + + LassoNode *request_authn_context; + gint i; + + /* + all arguments are optional + however, we need at least one to create the RequestAuthnContext element + */ + if (authnContextClassRefs || authnContextStatementRefs || authnContextComparison) { + /* ok, we create a new RequestAuthnContext instance */ + request_authn_context = lasso_lib_request_authn_context_new(); + /* AuthnContextClassRefs */ + if (authnContextClassRefs != NULL) { + if (authnContextClassRefs->len > 0) { + for(i=0; i<authnContextClassRefs->len; i++) { + lasso_lib_request_authn_context_add_authnContextClassRef(LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context), + lasso_g_ptr_array_index(authnContextClassRefs, i)); + } + } + } + /* AuthnContextStatementRefs */ + if (authnContextStatementRefs != NULL) { + if (authnContextStatementRefs->len > 0) { + for(i=0; i<authnContextStatementRefs->len; i++) { + lasso_lib_request_authn_context_add_authnContextStatementRef(LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context), + lasso_g_ptr_array_index(authnContextStatementRefs, i)); + } + } + } + /* AuthnContextComparison */ + if (authnContextComparison != NULL) { + lasso_lib_request_authn_context_set_authnContextComparison(LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context), + authnContextComparison); + } + /* Add RequestAuthnContext in AuthnRequest */ + lasso_lib_authn_request_set_requestAuthnContext(LASSO_LIB_AUTHN_REQUEST(request), + LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context)); + } +} + +void +lasso_authn_request_set_scoping(LassoAuthnRequest *request, + gint proxyCount) +{ + g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request)); + + LassoNode *scoping; + + /* create a new Scoping instance */ + scoping = lasso_lib_scoping_new(); + /* ProxyCount */ + lasso_lib_scoping_set_proxyCount(LASSO_LIB_SCOPING(scoping), proxyCount); + /* FIXME : set IDPList here */ + lasso_lib_authn_request_set_scoping(LASSO_LIB_AUTHN_REQUEST(request), + LASSO_LIB_SCOPING(scoping)); +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +lasso_authn_request_instance_init(LassoAuthnRequest *request) +{ +} + +static void +lasso_authn_request_class_init(LassoAuthnRequestClass *class) +{ +} + +GType lasso_authn_request_get_type() { + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoAuthnRequestClass), + NULL, + NULL, + (GClassInitFunc) lasso_authn_request_class_init, + NULL, + NULL, + sizeof(LassoAuthnRequest), + 0, + (GInstanceInitFunc) lasso_authn_request_instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_LIB_AUTHN_REQUEST, + "LassoAuthnRequest", + &this_info, 0); + } + return this_type; +} + +LassoNode* +lasso_authn_request_new(const xmlChar *providerID) +{ + LassoNode *request; + + request = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_REQUEST, NULL)); + + /* Set ONLY required elements/attributs */ + /* RequestID */ + lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), + (const xmlChar *)lasso_build_unique_id(32)); + /* MajorVersion */ + lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), + lassoLibMajorVersion); + /* MinorVersion */ + lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), + lassoLibMinorVersion); + /* IssueInstant */ + lasso_samlp_request_abstract_set_issueInstance(LASSO_SAMLP_REQUEST_ABSTRACT(request), + lasso_get_current_time()); + /* ProviderID */ + lasso_lib_authn_request_set_providerID(LASSO_LIB_AUTHN_REQUEST(request), + providerID); + + return (request); +} diff --git a/lasso/Attic/protocols/sso_and_federation_authn_request.h b/lasso/Attic/protocols/sso_and_federation_authn_request.h new file mode 100644 index 00000000..f83ae7f1 --- /dev/null +++ b/lasso/Attic/protocols/sso_and_federation_authn_request.h @@ -0,0 +1,70 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.com> + * + * 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 + */ + +#ifndef __LASSO_SSOAF_AUTHN_REQUEST_H__ +#define __LASSO_SSOAF_AUTHN_REQUEST_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/lib_authn_request.h> + +#define LASSO_TYPE_AUTHN_REQUEST (lasso_authn_request_get_type()) +#define LASSO_AUTHN_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_AUTHN_REQUEST, LassoAuthnRequest)) +#define LASSO_AUTHN_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_AUTHN_REQUEST, LassoAuthnRequestClass)) +#define LASSO_IS_AUTHN_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_AUTHN_REQUEST)) +#define LASSP_IS_AUTHN_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_AUTHN_REQUEST)) +#define LASSO_AUTHN_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_AUTHN_REQUEST, LassoAuthnRequestClass)) + +typedef struct _LassoAuthnRequest LassoAuthnRequest; +typedef struct _LassoAuthnRequestClass LassoAuthnRequestClass; + +struct _LassoAuthnRequest { + LassoLibAuthnRequest parent; + /*< public >*/ + /*< private >*/ +}; + +struct _LassoAuthnRequestClass { + LassoLibAuthnRequestClass parent; +}; + +LASSO_EXPORT GType lasso_authn_request_get_type (void); +LASSO_EXPORT LassoNode* lasso_authn_request_new (const xmlChar *providerID); + +LASSO_EXPORT void lasso_authn_request_set_requestAuthnContext (LassoAuthnRequest *request, + GPtrArray *authnContextClassRefs, + GPtrArray *authnContextStatementRefs, + const xmlChar *authnContextComparison); + +LASSO_EXPORT void lasso_authn_request_set_scoping (LassoAuthnRequest *request, + gint proxyCount); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_SSOAF_AUTHN_REQUEST_H__ */ |
