summaryrefslogtreecommitdiff
path: root/cpp/src/Glacier2/ProxyVerifier.h
blob: d73a64e6f28bfb51daf2967d524fb2cbcb52f65f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// **********************************************************************
//
// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef ICE_PROXY_VERIFIER_H
#define ICE_PROXY_VERIFIER_H

#include <Ice/Ice.h>
#include <vector>

namespace Glacier2
{

//
// Base class for proxy rule implementations. 
//

class ProxyRule
{
public:

    virtual ~ProxyRule() {}

    //
    // Checks to see if the proxy passes.
    //
    virtual bool check(const Ice::ObjectPrx&) const = 0;
};

class ProxyVerifier : public IceUtil::Shared
{
public:

    ProxyVerifier(const Ice::CommunicatorPtr&);
    ~ProxyVerifier();

    //
    // Verifies that the proxy is permissible under the configured
    // rules.
    //
    bool verify(const Ice::ObjectPrx&);

private:

    const Ice::CommunicatorPtr _communicator;
    const int _traceLevel;

    std::vector<ProxyRule*> _acceptRules;
    std::vector<ProxyRule*> _rejectRules;
};
typedef IceUtil::Handle<ProxyVerifier> ProxyVerifierPtr;

}
#endif