/*\r
- * Copyright 2001-2005 Internet2\r
+ * Copyright 2001-2007 Internet2\r
* \r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
void testSAML2Artifact() {\r
try {\r
QName idprole(samlconstants::SAML20MD_NS, IDPSSODescriptor::LOCAL_NAME);\r
- SecurityPolicy policy(m_rules2, m_metadata, &idprole, m_trust);\r
+ SecurityPolicy policy(m_rules2, m_metadata, &idprole, m_trust, false);\r
\r
// Read message to use from file.\r
string path = data_path + "saml2/binding/SAML2Response.xml";\r
);\r
janitor.release();\r
\r
+ CredentialCriteria cc;\r
+ cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL);\r
+ Locker clocker(m_creds);\r
+ const Credential* cred = m_creds->resolve(&cc);\r
+ TSM_ASSERT("Retrieved credential was null", cred!=NULL);\r
+\r
// Freshen timestamp.\r
toSend->setIssueInstant(time(NULL));\r
\r
SAMLConfig::getConfig().MessageEncoderManager.newPlugin(samlconstants::SAML20_BINDING_HTTP_ARTIFACT, NULL)\r
);\r
encoder->setArtifactGenerator(this);\r
- encoder->encode(*this,toSend.get(),"https://sp.example.org/SAML/SSO","https://sp.example.org/","state",m_creds);\r
+ Locker locker(m_metadata);
+ encoder->encode(
+ *this,toSend.get(),"https://sp.example.org/SAML/SSO",m_metadata->getEntityDescriptor("https://sp.example.org/"),"state",cred
+ );
toSend.release();\r
\r
// Decode message.\r
SAMLConfig::getConfig().MessageDecoderManager.newPlugin(samlconstants::SAML20_BINDING_HTTP_ARTIFACT, NULL)\r
);\r
decoder->setArtifactResolver(this);\r
- Locker locker(m_metadata);\r
auto_ptr<Response> response(dynamic_cast<Response*>(decoder->decode(relayState,*this,policy)));\r
\r
// Test the results.\r
}\r
}\r
\r
- SAMLArtifact* generateSAML1Artifact(const char* relyingParty) const {\r
+ SAMLArtifact* generateSAML1Artifact(const EntityDescriptor* relyingParty) const {\r
throw BindingException("Not implemented.");\r
}\r
\r
- saml2p::SAML2Artifact* generateSAML2Artifact(const char* relyingParty) const {\r
+ saml2p::SAML2Artifact* generateSAML2Artifact(const EntityDescriptor* relyingParty) const {\r
return new SAML2ArtifactType0004(SAMLConfig::getConfig().hashSHA1("https://idp.example.org/"),1);\r
}\r
\r
SAMLConfig::getConfig().getArtifactMap()->retrieveContent(&artifact, "https://sp.example.org/");\r
Response* payload = dynamic_cast<Response*>(xmlObject);\r
TSM_ASSERT("Not a response.", payload!=NULL);\r
+\r
auto_ptr<ArtifactResponse> response(ArtifactResponseBuilder::buildArtifactResponse());\r
response->setPayload(payload);\r
Status* status = StatusBuilder::buildStatus();\r
sc->setValue(StatusCode::SUCCESS);\r
response->marshall();\r
SchemaValidators.validate(response.get());\r
+ policy.evaluate(*(response.get()), this);\r
return response.release();\r
}\r
};\r