* 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)
radius = static_cast<const gss_eap_radius_attr_provider *>
(m_manager->getProvider(ATTR_TYPE_RADIUS));
if (radius != NULL &&
- radius->getAttribute(512 /* XXX */, &authenticated, &complete,
+ radius->getAttribute(PW_SAML_ASSERTION, &authenticated, &complete,
&value, NULL, &more)) {
setAssertion(&value, authenticated);
gss_release_buffer(&minor, &value);
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)
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();
+ if (authenticated != NULL)
+ *authenticated = saml->authenticated();
+ if (pAssertion != NULL)
+ *pAssertion = saml->getAssertion();
- return (*pAssertion != NULL);
-}
-
-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) ||
av = dynamic_cast<const saml2::AttributeValue *>(a->getAttributeValues().at(i)
);
if (av != NULL) {
- value->value = toUTF8(av->getTextContent(), true);
- value->length = strlen((char *)value->value);
-
- if (display_value != NULL)
- duplicateBuffer(*value, display_value);
-
- if (nvalues > ++i)
- *more = i;
+ if (value != NULL) {
+ value->value = toUTF8(av->getTextContent(), true);
+ value->length = strlen((char *)value->value);
+ }
+ if (display_value != NULL) {
+ display_value->value = toUTF8(av->getTextContent(), true);
+ display_value->length = strlen((char *)value->value);
+ }
}
+ if (nvalues > ++i)
+ *more = i;
+
return true;
}