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_WSF_PROFILE_H__ 25 #define __LASSO_WSF_PROFILE_H__ 26 27 #ifdef __cplusplus 28 extern "C" { 29 30 #endif /* __cplusplus */ 31 32 #include "../id-ff/server.h" 33 #include "../id-ff/identity.h" 34 #include "../id-ff/session.h" 35 #include "../xml/soap-1.1/soap_envelope.h" 36 #include "../xml/soap_binding_provider.h" 37 #include "../xml/soap-1.1/soap_fault.h" 38 #include "../xml/saml_assertion.h" 39 #include "../xml/disco_description.h" 40 #include "../xml/disco_resource_offering.h" 41 #include "../xml/disco_description.h" 42 43 #define LASSO_TYPE_WSF_PROFILE (lasso_wsf_profile_get_type()) 44 #define LASSO_WSF_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ 45 LASSO_TYPE_WSF_PROFILE, LassoWsfProfile)) 46 #define LASSO_WSF_PROFILE_CLASS(klass) \ 47 (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_WSF_PROFILE, LassoWsfProfileClass)) 48 #define LASSO_IS_WSF_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_WSF_PROFILE)) 49 #define LASSO_IS_WSF_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 50 LASSO_TYPE_WSF_PROFILE)) 51 #define LASSO_WSF_PROFILE_GET_CLASS(o) \ 52 (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_WSF_PROFILE, LassoWsfProfileClass)) 53 54 typedef struct _LassoWsfProfile LassoWsfProfile; 55 typedef struct _LassoWsfProfileClass LassoWsfProfileClass; 56 typedef struct _LassoWsfProfilePrivate LassoWsfProfilePrivate; 57 58 struct _LassoWsfProfile { 59 LassoNode parent; 60 61 LassoServer *server; 62 63 LassoNode *request; 64 LassoNode *response; 65 66 LassoSoapEnvelope *soap_envelope_request; 67 LassoSoapEnvelope *soap_envelope_response; 68 69 gchar *msg_url; 70 gchar *msg_body; 71 72 /*< private >*/ 73 LassoIdentity *identity; 74 LassoSession *session; 75 76 LassoWsfProfilePrivate *private_data; 77 }; 78 79 struct _LassoWsfProfileClass { 80 LassoNodeClass parent; 81 }; 82 83 LASSO_EXPORT GType lasso_wsf_profile_get_type(void); 84 85 G_GNUC_DEPRECATED LASSO_EXPORT lasso_error_t lasso_wsf_profile_move_credentials(LassoWsfProfile *src, 86 LassoWsfProfile *dest); 87 88 LASSO_EXPORT LassoIdentity* lasso_wsf_profile_get_identity(const LassoWsfProfile *profile); 89 LASSO_EXPORT LassoSession* lasso_wsf_profile_get_session(const LassoWsfProfile *profile); 90 LASSO_EXPORT gboolean lasso_wsf_profile_is_identity_dirty(const LassoWsfProfile *profile); 91 LASSO_EXPORT gboolean lasso_wsf_profile_is_session_dirty(const LassoWsfProfile *profile); 92 LASSO_EXPORT lasso_error_t lasso_wsf_profile_set_identity_from_dump(LassoWsfProfile *profile, 93 const gchar *dump); 94 LASSO_EXPORT lasso_error_t lasso_wsf_profile_set_session_from_dump(LassoWsfProfile *profile, 95 const gchar *dump); 96 97 G_GNUC_DEPRECATED LASSO_EXPORT LassoSoapEnvelope* lasso_wsf_profile_build_soap_envelope( 98 const char *refToMessageId, 99 const char *providerId); 100 101 LASSO_EXPORT lasso_error_t lasso_wsf_profile_build_soap_request_msg(LassoWsfProfile *profile); 102 103 LASSO_EXPORT lasso_error_t lasso_wsf_profile_build_soap_response_msg(LassoWsfProfile *profile); 104 105 LASSO_EXPORT lasso_error_t lasso_wsf_profile_init_soap_request(LassoWsfProfile *profile, LassoNode *request); 106 107 LASSO_EXPORT lasso_error_t lasso_wsf_profile_init_soap_response(LassoWsfProfile *profile, 108 LassoNode *response); 109 110 LASSO_EXPORT lasso_error_t lasso_wsf_profile_process_soap_request_msg(LassoWsfProfile *profile, 111 const gchar *message, const gchar *security_mech_id); 112 113 LASSO_EXPORT lasso_error_t lasso_wsf_profile_process_soap_response_msg(LassoWsfProfile *profile, 114 const gchar *message); 115 116 G_GNUC_DEPRECATED LASSO_EXPORT LassoSoapBindingProvider* lasso_wsf_profile_set_provider_soap_request( 117 LassoWsfProfile *profile, const char *providerId); 118 119 LASSO_EXPORT LassoWsfProfile* lasso_wsf_profile_new(LassoServer *server); 120 121 LASSO_EXPORT LassoWsfProfile* lasso_wsf_profile_new_full(LassoServer *server, 122 LassoDiscoResourceOffering *offering); 123 124 G_GNUC_DEPRECATED LASSO_EXPORT gboolean lasso_wsf_profile_principal_is_online( 125 LassoWsfProfile *profile); 126 127 G_GNUC_DEPRECATED LASSO_EXPORT lasso_error_t lasso_wsf_profile_add_credential(LassoWsfProfile *profile, 128 xmlNode *credential); 129 130 LASSO_EXPORT lasso_error_t lasso_wsf_profile_set_description_from_offering( 131 LassoWsfProfile *profile, 132 const LassoDiscoResourceOffering *offering, 133 const char *security_mech_id); 134 135 LASSO_EXPORT void lasso_wsf_profile_set_description(LassoWsfProfile *profile, 136 LassoDiscoDescription *description); 137 138 LASSO_EXPORT LassoDiscoDescription *lasso_wsf_profile_get_description( 139 const LassoWsfProfile *profile); 140 141 LASSO_EXPORT LassoDiscoResourceOffering *lasso_wsf_profile_get_resource_offering( 142 LassoWsfProfile *profile); 143 144 LASSO_EXPORT lasso_error_t lasso_wsf_profile_set_security_mech_id(LassoWsfProfile *profile, 145 const char *security_mech_id); 146 147 LASSO_EXPORT const char *lasso_wsf_profile_get_security_mech_id(LassoWsfProfile *profile); 148 149 LASSO_EXPORT lasso_error_t lasso_wsf_profile_init(LassoWsfProfile *profile, LassoServer *server, 150 LassoDiscoResourceOffering *offering); 151 152 LASSO_EXPORT lasso_error_t lasso_wsf_profile_get_remote_provider(LassoWsfProfile *wsf_profile, 153 LassoProvider **provider); 154 155 LASSO_EXPORT const char* lasso_wsf_profile_get_remote_provider_id(LassoWsfProfile *wsf_profile); 156 157 LASSO_EXPORT LassoSoapFault* lasso_wsf_profile_get_soap_fault(LassoWsfProfile *wsf_profile); 158 159 LASSO_EXPORT lasso_error_t lasso_wsf_profile_set_soap_fault(LassoWsfProfile *wsf_profile, LassoSoapFault *soap_fault); 160 161 LASSO_EXPORT lasso_error_t lasso_wsf_profile_set_status_code(LassoWsfProfile *wsf_profile, const char *code); 162 163 LASSO_EXPORT const char* lasso_wsf_profile_get_status_code(LassoWsfProfile *wsf_profile); 164 165 LASSO_EXPORT lasso_error_t lasso_wsf_profile_set_msg_url_from_description(LassoWsfProfile *wsf_profile); 166 167 LASSO_EXPORT void lasso_wsf_profile_set_resource_offering(LassoWsfProfile *profile, 168 LassoDiscoResourceOffering *offering); 169 170 #define lasso_wsf_profile_helper_assign_resource_id(from,to) \ 171 if ((from)->ResourceID) {\ 172 lasso_assign_gobject((to)->ResourceID, (from)->ResourceID); \ 173 } else if ((from)->EncryptedResourceID) {\ 174 lasso_assign_gobject((to)->EncryptedResourceID, (from)->EncryptedResourceID); \ 175 } 176 177 #define lasso_wsf_profile_helper_set_status(message, code) \ 178 { \ 179 lasso_assign_new_gobject(message->Status, lasso_utility_status_new(code)); \ 180 } 181 182 #ifdef __cplusplus 183 } 184 #endif /* __cplusplus */ 185 186 #endif /* __LASSO_WSF_PROFILE_H__ */ 187