X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=util_saml.h;h=eeb17e37a2b2eae6d18d3a2bb4efd2f24f03d4e8;hb=f12a2be8e6409006eaf326c204ea5c99b78b3b2b;hp=730ebd41cffc0f888cc90df22c19da5b777006e8;hpb=f1a6e02e9cb6c9e17b265c562c049b76501f6474;p=mech_eap.orig diff --git a/util_saml.h b/util_saml.h index 730ebd4..eeb17e3 100644 --- a/util_saml.h +++ b/util_saml.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, JANET(UK) + * Copyright (c) 2011, JANET(UK) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,9 +30,15 @@ * SUCH DAMAGE. */ +/* + * SAML attribute provider. + */ + #ifndef _UTIL_SAML_H_ #define _UTIL_SAML_H_ 1 +#ifdef __cplusplus + namespace opensaml { namespace saml2 { class Attribute; @@ -43,7 +49,7 @@ namespace opensaml { struct gss_eap_saml_assertion_provider : gss_eap_attr_provider { public: - gss_eap_saml_assertion_provider(void) {} + gss_eap_saml_assertion_provider(void); ~gss_eap_saml_assertion_provider(void); bool initFromExistingContext(const gss_eap_attr_ctx *source, @@ -53,10 +59,10 @@ public: const gss_ctx_id_t ctx); bool getAttributeTypes(gss_eap_attr_enumeration_cb, void *data) const; - void setAttribute(int complete, + bool setAttribute(int complete, const gss_buffer_t attr, const gss_buffer_t value); - void deleteAttribute(const gss_buffer_t value); + bool deleteAttribute(const gss_buffer_t value); bool getAttribute(const gss_buffer_t attr, int *authenticated, int *complete, @@ -68,18 +74,30 @@ public: void releaseAnyNameMapping(gss_buffer_t type_id, gss_any_t input) const; - void exportToBuffer(gss_buffer_t buffer) const; - bool initFromBuffer(const gss_eap_attr_ctx *ctx, - const gss_buffer_t buffer); + const char *prefix(void) const; + const char *name(void) const { return NULL; } + bool initWithJsonObject(const gss_eap_attr_ctx *manager GSSEAP_UNUSED, + JSONObject &object GSSEAP_UNUSED) { + return false; + } + JSONObject jsonRepresentation(void) const { + return JSONObject::null(); + } - void setAssertion(const opensaml::saml2::Assertion *assertion); + opensaml::saml2::Assertion *initAssertion(void); - const opensaml::saml2::Assertion *getAssertion(void) const { + opensaml::saml2::Assertion *getAssertion(void) const { return m_assertion; } + bool authenticated(void) const { + return m_authenticated; + } + + time_t getExpiryTime(void) const; + OM_uint32 mapException(OM_uint32 *minor, std::exception &e) const; - static bool init(); - static void finalize(); + static bool init(void); + static void finalize(void); static gss_eap_attr_provider *createAttrContext(void); @@ -87,19 +105,25 @@ private: static opensaml::saml2::Assertion * parseAssertion(const gss_buffer_t buffer); + void setAssertion(const opensaml::saml2::Assertion *assertion, + bool authenticated = false); + void setAssertion(const gss_buffer_t buffer, + bool authenticated = false); + opensaml::saml2::Assertion *m_assertion; + bool m_authenticated; }; struct gss_eap_saml_attr_provider : gss_eap_attr_provider { public: gss_eap_saml_attr_provider(void) {} - ~gss_eap_saml_attr_provider(void); + ~gss_eap_saml_attr_provider(void) {} bool getAttributeTypes(gss_eap_attr_enumeration_cb, void *data) const; - void setAttribute(int complete, + bool setAttribute(int complete, const gss_buffer_t attr, const gss_buffer_t value); - void deleteAttribute(const gss_buffer_t value); + bool deleteAttribute(const gss_buffer_t value); bool getAttribute(const gss_buffer_t attr, int *authenticated, int *complete, @@ -111,21 +135,42 @@ public: void releaseAnyNameMapping(gss_buffer_t type_id, gss_any_t input) const; - void exportToBuffer(gss_buffer_t buffer) const; - bool initFromBuffer(const gss_eap_attr_ctx *ctx, - const gss_buffer_t buffer); - - const opensaml::saml2::Attribute * - getAttribute(const gss_buffer_t attr) const; + const char *prefix(void) const; + const char *name(void) const { + return NULL; + } + bool initWithJsonObject(const gss_eap_attr_ctx *manager GSSEAP_UNUSED, + JSONObject &object GSSEAP_UNUSED) { + return false; + } + JSONObject jsonRepresentation(void) const { + return JSONObject::null(); + } - const opensaml::saml2::Assertion *getAssertion(void) const; + bool getAttribute(const gss_buffer_t attr, + int *authenticated, + int *complete, + const opensaml::saml2::Attribute **pAttribute) const; + bool getAssertion(int *authenticated, + opensaml::saml2::Assertion **pAssertion, + bool createIfAbsent = false) const; - static bool init(); - static void finalize(); + static bool init(void); + static void finalize(void); static gss_eap_attr_provider *createAttrContext(void); private: }; +extern "C" { +#endif + +OM_uint32 gssEapSamlAttrProvidersInit(OM_uint32 *minor); +OM_uint32 gssEapSamlAttrProvidersFinalize(OM_uint32 *minor); + +#ifdef __cplusplus +} +#endif + #endif /* _UTIL_SAML_H_ */