X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=blobdiff_plain;f=saml%2Fsaml2%2Fprofile%2Fimpl%2FBrowserSSOProfile20Validator.cpp;h=0869567edf28aaacb5804c2d2f1d621d8e12b115;hp=67b43a91fb1e8b0690c15900e10e074a210bbd17;hb=1462057b3b9ae7e165d34d988e30b14c213672ca;hpb=91925e3c549d33179ccc2d806b5974d33aa70a8a diff --git a/saml/saml2/profile/impl/BrowserSSOProfile20Validator.cpp b/saml/saml2/profile/impl/BrowserSSOProfile20Validator.cpp index 67b43a9..0869567 100644 --- a/saml/saml2/profile/impl/BrowserSSOProfile20Validator.cpp +++ b/saml/saml2/profile/impl/BrowserSSOProfile20Validator.cpp @@ -1,23 +1,27 @@ -/* - * Copyright 2001-2007 Internet2 +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. * - * 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 + * UCAID licenses this file to you 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. */ /** * BrowserSSOProfile20Validator.cpp * - * SAML 2.0 Browser SSO Profile Assertion Validator + * SAML 2.0 Browser SSO Profile Assertion Validator. */ #include "internal.h" @@ -25,6 +29,7 @@ #include "saml2/profile/BrowserSSOProfileValidator.h" #include +#include #include using namespace opensaml::saml2; @@ -32,12 +37,26 @@ using namespace xmltooling::logging; using namespace xmltooling; using namespace std; +BrowserSSOProfileValidator::BrowserSSOProfileValidator( + const XMLCh* recipient, + const vector* audiences, + time_t ts, + const char* destination, + const char* requestID + ) : AssertionValidator(recipient, audiences, ts), m_destination(destination), m_requestID(requestID) +{ +} + +BrowserSSOProfileValidator::~BrowserSSOProfileValidator() +{ +} + void BrowserSSOProfileValidator::validateAssertion(const Assertion& assertion) const { #ifdef _DEBUG xmltooling::NDC ndc("validate"); #endif - Category& log = Category::getInstance(SAML_LOGCAT".AssertionValidator"); + Category& log = Category::getInstance(SAML_LOGCAT ".AssertionValidator"); // The assertion MUST have proper confirmation requirements. const char* msg="assertion is missing bearer SubjectConfirmation"; @@ -49,14 +68,14 @@ void BrowserSSOProfileValidator::validateAssertion(const Assertion& assertion) c const SubjectConfirmationDataType* data = dynamic_cast((*sc)->getSubjectConfirmationData()); if (m_destination.get()) { - if (!XMLString::equals(m_destination.get(), data ? data->getRecipient() : NULL)) { + if (!XMLString::equals(m_destination.get(), data ? data->getRecipient() : nullptr)) { msg = "bearer confirmation failed with recipient mismatch"; continue; } } if (m_requestID.get()) { - if (!XMLString::equals(m_requestID.get(), data ? data->getInResponseTo() : NULL)) { + if (!XMLString::equals(m_requestID.get(), data ? data->getInResponseTo() : nullptr)) { msg = "bearer confirmation failed with request correlation mismatch"; continue; } @@ -89,3 +108,8 @@ void BrowserSSOProfileValidator::validateAssertion(const Assertion& assertion) c log.error(msg ? msg : "no error message"); throw ValidationException("Unable to locate satisfiable bearer SubjectConfirmation in assertion."); } + +const char* BrowserSSOProfileValidator::getAddress() const +{ + return m_address.c_str(); +}