3 * Copyright 2015 gRPC authors.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #include <grpc/grpc_security.h>
20 #include <grpcpp/security/auth_context.h>
24 AuthPropertyIterator::AuthPropertyIterator()
25 : property_(nullptr), ctx_(nullptr), index_(0), name_(nullptr) {}
27 AuthPropertyIterator::AuthPropertyIterator(
28 const grpc_auth_property* property, const grpc_auth_property_iterator* iter)
29 : property_(property),
34 AuthPropertyIterator::~AuthPropertyIterator() {}
36 AuthPropertyIterator& AuthPropertyIterator::operator++() {
37 grpc_auth_property_iterator iter = {ctx_, index_, name_};
38 property_ = grpc_auth_property_iterator_next(&iter);
45 AuthPropertyIterator AuthPropertyIterator::operator++(int) {
46 AuthPropertyIterator tmp(*this);
51 bool AuthPropertyIterator::operator==(const AuthPropertyIterator& rhs) const {
52 if (property_ == nullptr || rhs.property_ == nullptr) {
53 return property_ == rhs.property_;
55 return index_ == rhs.index_;
59 bool AuthPropertyIterator::operator!=(const AuthPropertyIterator& rhs) const {
60 return !operator==(rhs);
63 AuthProperty AuthPropertyIterator::operator*() {
64 return std::pair<grpc::string_ref, grpc::string_ref>(
66 grpc::string_ref(property_->value, property_->value_length));