* gss_eap_saml_assertion_provider is for retrieving the underlying
* assertion.
*/
+gss_eap_saml_assertion_provider::gss_eap_saml_assertion_provider(void)
+{
+ m_assertion = NULL;
+ m_authenticated = false;
+}
+
+gss_eap_saml_assertion_provider::~gss_eap_saml_assertion_provider(void)
+{
+ delete m_assertion;
+}
+
bool
gss_eap_saml_assertion_provider::initFromExistingContext(const gss_eap_attr_ctx *manager,
const gss_eap_attr_provider *ctx)
return true;
}
-gss_eap_saml_assertion_provider::~gss_eap_saml_assertion_provider(void)
-{
- delete m_assertion;
-}
-
void
gss_eap_saml_assertion_provider::setAssertion(const saml2::Assertion *assertion,
bool authenticated)
gss_eap_saml_assertion_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addAttribute,
void *data) const
{
+ bool ret;
+
/* just add the prefix */
- return addAttribute(this, GSS_C_NO_BUFFER, data);
+ if (m_assertion != NULL)
+ ret = addAttribute(this, GSS_C_NO_BUFFER, data);
+ else
+ ret = true;
+
+ return ret;
}
void
m_authenticated = false;
}
+time_t
+gss_eap_saml_assertion_provider::getExpiryTime(void) const
+{
+ saml2::Conditions *conditions;
+ time_t expiryTime = 0;
+
+ if (m_assertion == NULL)
+ return 0;
+
+ conditions = m_assertion->getConditions();
+
+ if (conditions != NULL && conditions->getNotOnOrAfter() != NULL)
+ expiryTime = conditions->getNotOnOrAfter()->getEpoch();
+
+ return expiryTime;
+}
+
bool
gss_eap_saml_assertion_provider::getAttribute(const gss_buffer_t attr,
int *authenticated,
if (*more != -1)
return false;
- *authenticated = m_authenticated;
- *complete = false;
+ if (authenticated != NULL)
+ *authenticated = m_authenticated;
+ if (complete != NULL)
+ *complete = true;
XMLHelper::serialize(m_assertion->marshall((DOMDocument *)NULL), str);
{
const gss_eap_saml_assertion_provider *saml;
- *authenticated = false;
- *pAssertion = NULL;
+ if (authenticated != NULL)
+ *authenticated = false;
+ if (pAssertion != NULL)
+ *pAssertion = NULL;
saml = static_cast<const gss_eap_saml_assertion_provider *>
(m_manager->getProvider(ATTR_TYPE_SAML_ASSERTION));
if (saml == NULL)
return false;
- *authenticated = saml->authenticated();
- *pAssertion = saml->getAssertion();
-
- return (*pAssertion != NULL);
-}
+ if (authenticated != NULL)
+ *authenticated = saml->authenticated();
+ if (pAssertion != NULL)
+ *pAssertion = saml->getAssertion();
-gss_eap_saml_attr_provider::~gss_eap_saml_attr_provider(void)
-{
- /* Nothing to do, we're just a wrapper around the assertion provider. */
+ return (saml->getAssertion() != NULL);
}
bool
{
const saml2::Assertion *assertion;
- *authenticated = false;
- *complete = true;
+ if (authenticated != NULL)
+ *authenticated = false;
+ if (complete != NULL)
+ *complete = true;
*pAttribute = NULL;
if (!getAssertion(authenticated, &assertion) ||
{
return new gss_eap_saml_attr_provider;
}
+
+OM_uint32
+gssEapSamlAttrProvidersInit(OM_uint32 *minor)
+{
+ if (gss_eap_saml_assertion_provider::init() &&
+ gss_eap_saml_attr_provider::init())
+ return GSS_S_COMPLETE;
+
+ return GSS_S_FAILURE;
+}
+
+OM_uint32
+gssEapSamlAttrProvidersFinalize(OM_uint32 *minor)
+{
+ gss_eap_saml_attr_provider::finalize();
+ gss_eap_saml_assertion_provider::finalize();
+ return GSS_S_COMPLETE;
+}