X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=util_saml.h;h=70653263dc11feae221a0ac197c567c0edaef6f8;hb=81378d116795fa8a7a56dc8e00c3b2666126682d;hp=300f8224178ddd15360d5ad4085ca9f3592953e2;hpb=5016f2beb5eb340772c39a915582443609e2f9ab;p=mech_eap.git diff --git a/util_saml.h b/util_saml.h index 300f822..7065326 100644 --- a/util_saml.h +++ b/util_saml.h @@ -30,53 +30,115 @@ * SUCH DAMAGE. */ -#include "gssapiP_eap.h" - #ifndef _UTIL_SAML_H_ #define _UTIL_SAML_H_ 1 -struct eap_gss_saml_assertion; - -OM_uint32 -samlDuplicateAssertion(OM_uint32 *minor, - const struct eap_gss_saml_assertion *in, - struct eap_gss_saml_assertion **out); - -OM_uint32 -samlImportAssertion(OM_uint32 *minor, - gss_buffer_t buffer, - struct eap_gss_saml_assertion *pAssertion); - -OM_uint32 -samlExportAssertion(OM_uint32 *minor, - struct eap_gss_saml_assertion *assertion, - gss_buffer_t buffer); - -OM_uint32 -samlReleaseAssertion(OM_uint32 *minor, - struct eap_gss_saml_assertion **assertion); - -OM_uint32 -samlGetAttributeTypes(OM_uint32 *minor, - const struct eap_gss_saml_assertion *assertion, - void *data, - OM_uint32 (*addAttribute)(OM_uint32 *, void *, gss_buffer_t)); - -OM_uint32 -samlGetAttribute(OM_uint32 *minor, - const struct eap_gss_saml_assertion *assertion, - gss_buffer_t attr, - int *authenticated, - int *complete, - gss_buffer_t value, - gss_buffer_t display_value, - int *more); - -OM_uint32 -samlSetAttribute(OM_uint32 *minor, - struct eap_gss_saml_assertion *assertion, - int complete, - gss_buffer_t attr, - gss_buffer_t value); +namespace opensaml { + namespace saml2 { + class Attribute; + class Assertion; + class NameID; + }; +}; + +struct gss_eap_saml_assertion_provider : gss_eap_attr_provider { +public: + gss_eap_saml_assertion_provider(const gss_eap_attr_ctx *ctx, + const gss_buffer_t buffer) + : gss_eap_attr_provider(ctx) + { + m_assertion = parseAssertion(buffer); + } + + gss_eap_saml_assertion_provider(const gss_eap_attr_ctx *ctx, + gss_cred_id_t acceptorCred, + gss_ctx_id_t acceptorCtx); + + ~gss_eap_saml_assertion_provider(void); + + bool getAttributeTypes(gss_eap_attr_enumeration_cb, void *data) const; + void setAttribute(int complete, + const gss_buffer_t attr, + const gss_buffer_t value); + void deleteAttribute(const gss_buffer_t value); + bool getAttribute(const gss_buffer_t attr, + int *authenticated, + int *complete, + gss_buffer_t value, + gss_buffer_t display_value, + int *more) const; + gss_any_t mapToAny(int authenticated, + gss_buffer_t type_id) const; + void releaseAnyNameMapping(gss_buffer_t type_id, + gss_any_t input) const; + + void marshall(gss_buffer_t buffer) const; + static gss_eap_attr_provider *unmarshall(const gss_eap_attr_ctx *ctx, + const gss_buffer_t buffer); + + void setAssertion(const opensaml::saml2::Assertion *assertion); + + const opensaml::saml2::Assertion *getAssertion(void) const { + return m_assertion; + } + + static bool init(); + static void finalize(); + + static gss_eap_attr_provider * + createAttrContext(const gss_eap_attr_ctx *ctx, + gss_cred_id_t acceptorCred, + gss_ctx_id_t acceptorCtx); +private: + static opensaml::saml2::Assertion * + parseAssertion(const gss_buffer_t buffer); + + opensaml::saml2::Assertion *m_assertion; +}; + +struct gss_eap_saml_attr_provider : gss_eap_attr_provider { +public: + gss_eap_saml_attr_provider(const gss_eap_attr_ctx *ctx) + : gss_eap_attr_provider(ctx) {} + + gss_eap_saml_attr_provider(const gss_eap_attr_ctx *ctx, + gss_cred_id_t acceptorCred, + gss_ctx_id_t acceptorCtx); + + ~gss_eap_saml_attr_provider(void); + + bool getAttributeTypes(gss_eap_attr_enumeration_cb, void *data) const; + void setAttribute(int complete, + const gss_buffer_t attr, + const gss_buffer_t value); + void deleteAttribute(const gss_buffer_t value); + bool getAttribute(const gss_buffer_t attr, + int *authenticated, + int *complete, + gss_buffer_t value, + gss_buffer_t display_value, + int *more) const; + gss_any_t mapToAny(int authenticated, + gss_buffer_t type_id) const; + void releaseAnyNameMapping(gss_buffer_t type_id, + gss_any_t input) const; + + void marshall(gss_buffer_t buffer) const; + static gss_eap_attr_provider *unmarshall(const gss_eap_attr_ctx *ctx, + const gss_buffer_t buffer); + + const opensaml::saml2::Attribute * + getAttribute(const gss_buffer_t attr) const; + + const opensaml::saml2::Assertion *getAssertion(void) const; + + static bool init(); + static void finalize(); + + static gss_eap_attr_provider * + createAttrContext(const gss_eap_attr_ctx *ctx, + gss_cred_id_t acceptorCred, + gss_ctx_id_t acceptorCtx); +}; #endif /* _UTIL_SAML_H_ */