projects
/
mech_eap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Better error reporting through com_err
[mech_eap.git]
/
util_shib.cpp
diff --git
a/util_shib.cpp
b/util_shib.cpp
index
9f46ead
..
a37329f
100644
(file)
--- a/
util_shib.cpp
+++ b/
util_shib.cpp
@@
-31,7
+31,7
@@
*/
/*
* Copyright 2001-2009 Internet2
*/
/*
* Copyright 2001-2009 Internet2
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@
-45,35
+45,20
@@
* limitations under the License.
*/
* limitations under the License.
*/
-#include "gssapiP_eap.h"
-
-#include <shibsp/Application.h>
#include <shibsp/exceptions.h>
#include <shibsp/exceptions.h>
-#include <shibsp/SPConfig.h>
-#include <shibsp/ServiceProvider.h>
-#include <shibsp/attribute/Attribute.h>
#include <shibsp/attribute/SimpleAttribute.h>
#include <shibsp/attribute/SimpleAttribute.h>
-#include <shibsp/attribute/resolver/ResolutionContext.h>
-#include <shibsp/handler/AssertionConsumerService.h>
-#include <shibsp/metadata/MetadataProviderCriteria.h>
-#include <shibsp/util/SPConstants.h>
-#include <saml/saml1/core/Assertions.h>
-#include <saml/saml2/core/Assertions.h>
-#include <saml/saml2/metadata/Metadata.h>
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xmltooling/XMLToolingConfig.h>
-#include <xmltooling/util/XMLHelper.h>
+#include <shibresolver/resolver.h>
-#include "resolver.h"
+#include <sstream>
+
+#include "gssapiP_eap.h"
using namespace shibsp;
using namespace shibresolver;
using namespace opensaml::saml2md;
using namespace opensaml;
using namespace shibsp;
using namespace shibresolver;
using namespace opensaml::saml2md;
using namespace opensaml;
-using namespace xmltooling::logging;
using namespace xmltooling;
using namespace xmltooling;
-using namespace xercesc;
using namespace std;
gss_eap_shib_attr_provider::gss_eap_shib_attr_provider(void)
using namespace std;
gss_eap_shib_attr_provider::gss_eap_shib_attr_provider(void)
@@
-165,19
+150,21
@@
gss_eap_shib_attr_provider::initFromGssContext(const gss_eap_attr_ctx *manager,
const gss_eap_saml_assertion_provider *saml;
const gss_eap_radius_attr_provider *radius;
gss_buffer_desc nameBuf = GSS_C_EMPTY_BUFFER;
const gss_eap_saml_assertion_provider *saml;
const gss_eap_radius_attr_provider *radius;
gss_buffer_desc nameBuf = GSS_C_EMPTY_BUFFER;
- ShibbolethResolver *resolver
= NULL
;
+ ShibbolethResolver *resolver;
OM_uint32 minor;
if (!gss_eap_attr_provider::initFromGssContext(manager, gssCred, gssCtx))
return false;
saml = static_cast<const gss_eap_saml_assertion_provider *>
OM_uint32 minor;
if (!gss_eap_attr_provider::initFromGssContext(manager, gssCred, gssCtx))
return false;
saml = static_cast<const gss_eap_saml_assertion_provider *>
- (manager->getProvider(ATTR_TYPE_SAML_ASSERTION));
+ (m
_m
anager->getProvider(ATTR_TYPE_SAML_ASSERTION));
radius = static_cast<const gss_eap_radius_attr_provider *>
radius = static_cast<const gss_eap_radius_attr_provider *>
- (manager->getProvider(ATTR_TYPE_RADIUS));
+ (m_manager->getProvider(ATTR_TYPE_RADIUS));
+
+ resolver = ShibbolethResolver::create();
if (gssCred != GSS_C_NO_CREDENTIAL &&
if (gssCred != GSS_C_NO_CREDENTIAL &&
- gss
_display_n
ame(&minor, gssCred->name, &nameBuf, NULL) == GSS_S_COMPLETE)
+ gss
EapDisplayN
ame(&minor, gssCred->name, &nameBuf, NULL) == GSS_S_COMPLETE)
resolver->setApplicationID((const char *)nameBuf.value);
m_authenticated = false;
resolver->setApplicationID((const char *)nameBuf.value);
m_authenticated = false;
@@
-193,7
+180,10
@@
gss_eap_shib_attr_provider::initFromGssContext(const gss_eap_attr_ctx *manager,
m_authenticated = saml->authenticated();
}
m_authenticated = saml->authenticated();
}
- resolver->resolveAttributes(m_attributes);
+ resolver->resolve();
+
+ m_attributes = resolver->getResolvedAttributes();
+ resolver->getResolvedAttributes().clear();
gss_release_buffer(&minor, &nameBuf);
gss_release_buffer(&minor, &nameBuf);
@@
-230,16
+220,13
@@
gss_eap_shib_attr_provider::setAttribute(int complete,
const gss_buffer_t value)
{
string attrStr((char *)attr->value, attr->length);
const gss_buffer_t value)
{
string attrStr((char *)attr->value, attr->length);
- vector <string> ids(1);
-
- ids.push_back(attrStr);
-
+ vector <string> ids(1, attrStr);
SimpleAttribute *a = new SimpleAttribute(ids);
if (value->length != 0) {
string valueStr((char *)value->value, value->length);
SimpleAttribute *a = new SimpleAttribute(ids);
if (value->length != 0) {
string valueStr((char *)value->value, value->length);
- a->getValues().push_back(valueStr);
+ a->getValues().push_back(valueStr);
}
m_attributes.push_back(a);
}
m_attributes.push_back(a);
@@
-339,7
+326,7
@@
gss_eap_shib_attr_provider::getAttribute(const gss_buffer_t attr,
duplicateBuffer(buf, display_value);
}
duplicateBuffer(buf, display_value);
}
- if (authenticated != NULL)
+ if (authenticated != NULL)
*authenticated = m_authenticated;
if (complete != NULL)
*complete = false;
*authenticated = m_authenticated;
if (complete != NULL)
*complete = false;
@@
-356,6
+343,9
@@
gss_eap_shib_attr_provider::mapToAny(int authenticated,
{
gss_any_t output;
{
gss_any_t output;
+ if (authenticated && !m_authenticated)
+ return (gss_any_t)NULL;
+
vector <Attribute *>v = duplicateAttributes(m_attributes);
output = (gss_any_t)new vector <Attribute *>(v);
vector <Attribute *>v = duplicateAttributes(m_attributes);
output = (gss_any_t)new vector <Attribute *>(v);
@@
-452,8
+442,8
@@
gss_eap_shib_attr_provider::init(void)
void
gss_eap_shib_attr_provider::finalize(void)
{
void
gss_eap_shib_attr_provider::finalize(void)
{
- ShibbolethResolver::term();
gss_eap_attr_ctx::unregisterProvider(ATTR_TYPE_LOCAL);
gss_eap_attr_ctx::unregisterProvider(ATTR_TYPE_LOCAL);
+ ShibbolethResolver::term();
}
gss_eap_attr_provider *
}
gss_eap_attr_provider *
@@
-465,10
+455,8
@@
gss_eap_shib_attr_provider::createAttrContext(void)
Attribute *
gss_eap_shib_attr_provider::duplicateAttribute(const Attribute *src)
{
Attribute *
gss_eap_shib_attr_provider::duplicateAttribute(const Attribute *src)
{
- Attribute *attribute;
-
DDF obj = src->marshall();
DDF obj = src->marshall();
- attribute = Attribute::unmarshall(obj);
+
Attribute *
attribute = Attribute::unmarshall(obj);
obj.destroy();
return attribute;
obj.destroy();
return attribute;
@@
-486,3
+474,20
@@
gss_eap_shib_attr_provider::duplicateAttributes(const vector <Attribute *>src)
return dst;
}
return dst;
}
+
+OM_uint32
+gssEapLocalAttrProviderInit(OM_uint32 *minor)
+{
+ if (!gss_eap_shib_attr_provider::init()) {
+ *minor = GSSEAP_SHIB_INIT_FAILURE;
+ return GSS_S_FAILURE;
+ }
+ return GSS_S_COMPLETE;
+}
+
+OM_uint32
+gssEapLocalAttrProviderFinalize(OM_uint32 *minor)
+{
+ gss_eap_shib_attr_provider::finalize();
+ return GSS_S_COMPLETE;
+}