1 /* $Id$
2  *
3  * Lasso - A free implementation of the Liberty Alliance specifications.
4  *
5  * Copyright (C) 2004-2007 Entr'ouvert
6  * http://lasso.entrouvert.org
7  *
8  * Authors: See AUTHORS file in top-level directory.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef __LASSO_ECP_H__
25 #define __LASSO_ECP_H__
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30 
31 #include "../xml/xml.h"
32 
33 #include "../id-ff/profile.h"
34 #include "../xml/saml-2.0/samlp2_idp_list.h"
35 
36 #define LASSO_TYPE_ECP (lasso_ecp_get_type())
37 #define LASSO_ECP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_ECP, LassoEcp))
38 #define LASSO_ECP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_ECP, LassoEcpClass))
39 #define LASSO_IS_ECP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_ECP))
40 #define LASSO_IS_ECP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_ECP))
41 #define LASSO_ECP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_ECP, LassoEcpClass))
42 
43 typedef struct _LassoEcp LassoEcp;
44 typedef struct _LassoEcpClass LassoEcpClass;
45 typedef struct _LassoEcpPrivate LassoEcpPrivate;
46 
47 struct _LassoEcp {
48 	LassoProfile parent;
49 
50 	/*< public >*/
51 	gchar *assertion_consumer_url;
52 	gchar *message_id;
53 	gchar *response_consumer_url;
54 	gchar *relaystate;
55 	LassoSaml2NameID *issuer;
56 	gchar *provider_name;
57 	gboolean is_passive;
58 	LassoSamlp2IDPList *sp_idp_list;
59 	GList *known_sp_provided_idp_entries_supporting_ecp; /* of LassoSamlp2IDPEntry */
60 	GList *known_idp_entity_ids_supporting_ecp;	         /* of strings */
61 
62 	/*< private >*/
63 	LassoEcpPrivate *private_data;
64 };
65 
66 struct _LassoEcpClass {
67 	LassoProfileClass parent_class;
68 };
69 
70 LASSO_EXPORT GType lasso_ecp_get_type(void);
71 
72 LASSO_EXPORT LassoEcp* lasso_ecp_new(LassoServer *server);
73 
74 LASSO_EXPORT lasso_error_t lasso_ecp_process_authn_request_msg(LassoEcp *ecp,
75 		const char *authn_request_msg);
76 
77 LASSO_EXPORT lasso_error_t lasso_ecp_process_response_msg(LassoEcp *ecp,
78 		const char *response_msg);
79 
80 LASSO_EXPORT void lasso_ecp_destroy(LassoEcp *ecp);
81 
82 LASSO_EXPORT gboolean lasso_ecp_is_provider_in_sp_idplist(LassoEcp *ecp, const gchar *entity_id);
83 
84 LASSO_EXPORT gboolean lasso_ecp_is_idp_entry_known_idp_supporting_ecp(LassoEcp *ecp, const LassoSamlp2IDPEntry *idp_entry);
85 
86 LASSO_EXPORT void lasso_ecp_set_known_sp_provided_idp_entries_supporting_ecp(LassoEcp *ecp);
87 
88 LASSO_EXPORT gboolean lasso_ecp_has_sp_idplist(LassoEcp *ecp);
89 
90 LASSO_EXPORT gchar *lasso_ecp_get_endpoint_url_by_entity_id(LassoEcp *ecp, const gchar *entity_id);
91 
92 LASSO_EXPORT int lasso_ecp_process_sp_idp_list(LassoEcp *ecp, const LassoSamlp2IDPList *sp_idp_list);
93 
94 
95 #ifdef __cplusplus
96 }
97 #endif /* __cplusplus */
98 
99 #endif /* __LASSO_ECP_H__ */
100