Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
PermissionsVerifier.h
1// Copyright (c) ZeroC, Inc.
2
3// slice2cpp version 3.8.0-alpha.0
4// <auto-generated>Generated from Slice file 'PermissionsVerifier.ice'.</auto-generated>
5// clang-format off
6
7#ifndef Glacier2_PermissionsVerifier_h_
8#define Glacier2_PermissionsVerifier_h_
9
11#include <Ice/Ice.h>
12#include "SSLInfo.h"
13#include <Glacier2/Config.h>
14
15#ifndef ICE_DISABLE_VERSION
16# if ICE_INT_VERSION != 30850
17# error Ice version mismatch: an exact match is required for beta generated code
18# endif
19#endif
20
21#ifndef GLACIER2_API
22# if defined(GLACIER2_API_EXPORTS)
23# define GLACIER2_API ICE_DECLSPEC_EXPORT
24# else
25# define GLACIER2_API ICE_DECLSPEC_IMPORT
26# endif
27#endif
28
29// NOLINTBEGIN(modernize-concat-nested-namespaces)
30
31namespace Glacier2
32{
34
36}
37
38namespace Glacier2
39{
40 /// Represents an object that checks user permissions. The Glacier2 router and other services use a
41 /// PermissionsVerifierPrx proxy when the user is authenticated using a user ID and password.
42 /// @headerfile Glacier2/Glacier2.h
43 class GLACIER2_API PermissionsVerifierPrx : public Ice::Proxy<PermissionsVerifierPrx, Ice::ObjectPrx>
44 {
45 public:
46 /// Constructs a proxy from a Communicator and a proxy string.
47 /// @param communicator The communicator of the new proxy.
48 /// @param proxyString The proxy string to parse.
49 PermissionsVerifierPrx(const Ice::CommunicatorPtr& communicator, std::string_view proxyString) : Ice::ObjectPrx{communicator, proxyString} {} // NOLINT(modernize-use-equals-default)
50
51 /// Copy constructor. Constructs with a copy of the contents of @p other.
52 /// @param other The proxy to copy from.
53 PermissionsVerifierPrx(const PermissionsVerifierPrx& other) noexcept : Ice::ObjectPrx{other} {} // NOLINT(modernize-use-equals-default)
54
55 /// Move constructor. Constructs a proxy with the contents of @p other using move semantics.
56 /// @param other The proxy to move from.
57 PermissionsVerifierPrx(PermissionsVerifierPrx&& other) noexcept : Ice::ObjectPrx{std::move(other)} {} // NOLINT(modernize-use-equals-default)
58
59 ~PermissionsVerifierPrx() override;
60
61 /// Copy assignment operator. Replaces the contents of this proxy with a copy of the contents of @p rhs.
62 /// @param rhs The proxy to copy from.
63 /// @return A reference to this proxy.
65 {
66 if (this != &rhs)
67 {
69 }
70 return *this;
71 }
72
73 /// Move assignment operator. Replaces the contents of this proxy with the contents of @p rhs using move semantics.
74 /// @param rhs The proxy to move from.
76 {
77 if (this != &rhs)
78 {
79 Ice::ObjectPrx::operator=(std::move(rhs));
80 }
81 return *this;
82 }
83
84 /// Checks if a user is authorized to establish a session.
85 /// @param userId The user ID.
86 /// @param password The user's password.
87 /// @param[out] reason The reason why access was denied.
88 /// @param context The request context.
89 /// @return `true` if access is granted, `false` otherwise.
90 /// @throws Glacier2::PermissionDeniedException Thrown when the user's access is denied. This exception can be thrown
91 /// instead of returning `false` with a reason set in the reason out parameter.
92 bool checkPermissions(std::string_view userId, std::string_view password, std::string& reason, const Ice::Context& context = Ice::noExplicitContext) const;
93
94 /// Checks if a user is authorized to establish a session.
95 /// @param userId The user ID.
96 /// @param password The user's password.
97 /// @param context The request context.
98 /// @return A future that becomes available when the invocation completes. This future holds:
99 /// - `returnValue` `true` if access is granted, `false` otherwise.
100 /// - `reason` The reason why access was denied.
101 [[nodiscard]] std::future<std::tuple<bool, std::string>> checkPermissionsAsync(std::string_view userId, std::string_view password, const Ice::Context& context = Ice::noExplicitContext) const;
102
103 /// Checks if a user is authorized to establish a session.
104 /// @param userId The user ID.
105 /// @param password The user's password.
106 /// @param response The response callback. It accepts:
107 /// - `returnValue` `true` if access is granted, `false` otherwise.
108 /// - `reason` The reason why access was denied.
109 /// @param exception The exception callback.
110 /// @param sent The sent callback.
111 /// @param context The request context.
112 /// @return A function that can be called to cancel the invocation locally.
113 // NOLINTNEXTLINE(modernize-use-nodiscard)
114 std::function<void()> checkPermissionsAsync(std::string_view userId, std::string_view password, std::function<void(bool, std::string)> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;
115
116 /// @private
117 void _iceI_checkPermissions(const std::shared_ptr<IceInternal::OutgoingAsyncT<std::tuple<bool, std::string>>>&, std::string_view, std::string_view, const Ice::Context&) const;
118
119 /// Gets the type ID of the associated Slice interface.
120 /// @return The string `"::Glacier2::PermissionsVerifier"`.
121 static const char* ice_staticId() noexcept;
122
123 /// @private
124 static PermissionsVerifierPrx _fromReference(IceInternal::ReferencePtr ref) { return PermissionsVerifierPrx{std::move(ref)}; }
125
126 protected:
127 /// @private
128 PermissionsVerifierPrx() = default;
129
130 /// @private
131 explicit PermissionsVerifierPrx(IceInternal::ReferencePtr&& ref) : Ice::ObjectPrx{std::move(ref)}
132 {
133 }
134 };
135
136 /// Represents an object that checks user permissions. The Glacier2 router and other services use an
137 /// SSLPermissionsVerifierPrx proxy when the user is authenticated through an SSL certificate.
138 /// @headerfile Glacier2/Glacier2.h
139 class GLACIER2_API SSLPermissionsVerifierPrx : public Ice::Proxy<SSLPermissionsVerifierPrx, Ice::ObjectPrx>
140 {
141 public:
142 /// Constructs a proxy from a Communicator and a proxy string.
143 /// @param communicator The communicator of the new proxy.
144 /// @param proxyString The proxy string to parse.
145 SSLPermissionsVerifierPrx(const Ice::CommunicatorPtr& communicator, std::string_view proxyString) : Ice::ObjectPrx{communicator, proxyString} {} // NOLINT(modernize-use-equals-default)
146
147 /// Copy constructor. Constructs with a copy of the contents of @p other.
148 /// @param other The proxy to copy from.
149 SSLPermissionsVerifierPrx(const SSLPermissionsVerifierPrx& other) noexcept : Ice::ObjectPrx{other} {} // NOLINT(modernize-use-equals-default)
150
151 /// Move constructor. Constructs a proxy with the contents of @p other using move semantics.
152 /// @param other The proxy to move from.
153 SSLPermissionsVerifierPrx(SSLPermissionsVerifierPrx&& other) noexcept : Ice::ObjectPrx{std::move(other)} {} // NOLINT(modernize-use-equals-default)
154
155 ~SSLPermissionsVerifierPrx() override;
156
157 /// Copy assignment operator. Replaces the contents of this proxy with a copy of the contents of @p rhs.
158 /// @param rhs The proxy to copy from.
159 /// @return A reference to this proxy.
161 {
162 if (this != &rhs)
163 {
165 }
166 return *this;
167 }
168
169 /// Move assignment operator. Replaces the contents of this proxy with the contents of @p rhs using move semantics.
170 /// @param rhs The proxy to move from.
172 {
173 if (this != &rhs)
174 {
175 Ice::ObjectPrx::operator=(std::move(rhs));
176 }
177 return *this;
178 }
179
180 /// Checks if a user is authorized to establish a session.
181 /// @param info The SSL information.
182 /// @param[out] reason The reason why access was denied.
183 /// @param context The request context.
184 /// @return `true` if access is granted, `false` otherwise.
185 /// @throws Glacier2::PermissionDeniedException Thrown when the user's access is denied. This exception can be thrown
186 /// instead of returning `false` with a reason set in the reason out parameter.
187 bool authorize(const SSLInfo& info, std::string& reason, const Ice::Context& context = Ice::noExplicitContext) const;
188
189 /// Checks if a user is authorized to establish a session.
190 /// @param info The SSL information.
191 /// @param context The request context.
192 /// @return A future that becomes available when the invocation completes. This future holds:
193 /// - `returnValue` `true` if access is granted, `false` otherwise.
194 /// - `reason` The reason why access was denied.
195 [[nodiscard]] std::future<std::tuple<bool, std::string>> authorizeAsync(const SSLInfo& info, const Ice::Context& context = Ice::noExplicitContext) const;
196
197 /// Checks if a user is authorized to establish a session.
198 /// @param info The SSL information.
199 /// @param response The response callback. It accepts:
200 /// - `returnValue` `true` if access is granted, `false` otherwise.
201 /// - `reason` The reason why access was denied.
202 /// @param exception The exception callback.
203 /// @param sent The sent callback.
204 /// @param context The request context.
205 /// @return A function that can be called to cancel the invocation locally.
206 // NOLINTNEXTLINE(modernize-use-nodiscard)
207 std::function<void()> authorizeAsync(const SSLInfo& info, std::function<void(bool, std::string)> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;
208
209 /// @private
210 void _iceI_authorize(const std::shared_ptr<IceInternal::OutgoingAsyncT<std::tuple<bool, std::string>>>&, const SSLInfo&, const Ice::Context&) const;
211
212 /// Gets the type ID of the associated Slice interface.
213 /// @return The string `"::Glacier2::SSLPermissionsVerifier"`.
214 static const char* ice_staticId() noexcept;
215
216 /// @private
217 static SSLPermissionsVerifierPrx _fromReference(IceInternal::ReferencePtr ref) { return SSLPermissionsVerifierPrx{std::move(ref)}; }
218
219 protected:
220 /// @private
221 SSLPermissionsVerifierPrx() = default;
222
223 /// @private
224 explicit SSLPermissionsVerifierPrx(IceInternal::ReferencePtr&& ref) : Ice::ObjectPrx{std::move(ref)}
225 {
226 }
227 };
228}
229
230namespace Glacier2
231{
232 /// The exception that is thrown when a client is not allowed to create a session.
233 /// @headerfile Glacier2/Glacier2.h
235 {
236 public:
237 /// Default constructor.
238 PermissionDeniedException() noexcept = default;
239
240 /// One-shot constructor to initialize all data members.
241 /// @param reason The reason why permission was denied.
242 PermissionDeniedException(std::string reason) noexcept :
243 reason(std::move(reason))
244 {
245 }
246
247 /// Copy constructor.
249
250 /// Creates a tuple with all the fields of this exception.
251 /// @return A tuple with all the fields of this exception.
252 [[nodiscard]] std::tuple<const std::string&> ice_tuple() const
253 {
254 return std::tie(reason);
255 }
256
257 void ice_printFields(std::ostream& os) const override;
258 /// Gets the type ID of the associated Slice exception.
259 /// @return The string `"::Glacier2::PermissionDeniedException"`.
260 static const char* ice_staticId() noexcept;
261
262 [[nodiscard]] const char* ice_id() const noexcept override;
263
264 void ice_throw() const override;
265
266 /// The reason why permission was denied.
267 std::string reason;
268
269 protected:
270 /// @private
271 void _writeImpl(Ice::OutputStream*) const override;
272
273 /// @private
274 void _readImpl(Ice::InputStream*) override;
275 };
276}
277
278namespace Glacier2
279{
280 /// Represents an object that checks user permissions. The Glacier2 router and other services use a
281 /// PermissionsVerifierPrx proxy when the user is authenticated using a user ID and password.
282 /// @headerfile Glacier2/Glacier2.h
283 class GLACIER2_API PermissionsVerifier : public virtual Ice::Object
284 {
285 public:
286 /// The associated proxy type.
288
289 /// Dispatches an incoming request to one of the member functions of this generated class, based on the operation name carried by the request.
290 /// @param request The incoming request.
291 /// @param sendResponse The callback to send the response.
292 void dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse) override;
293
294 [[nodiscard]] std::vector<std::string> ice_ids(const Ice::Current& current) const override;
295
296 [[nodiscard]] std::string ice_id(const Ice::Current& current) const override;
297
298 /// Checks if a user is authorized to establish a session.
299 /// @param userId The user ID.
300 /// @param password The user's password.
301 /// @param[out] reason The reason why access was denied.
302 /// @param current The Current object of the incoming request.
303 /// @return `true` if access is granted, `false` otherwise.
304 /// @throws Glacier2::PermissionDeniedException Thrown when the user's access is denied. This exception can be thrown
305 /// instead of returning `false` with a reason set in the reason out parameter.
306 virtual bool checkPermissions(std::string userId, std::string password, std::string& reason, const Ice::Current& current) const = 0;
307
308 /// @private
309 void _iceD_checkPermissions(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>) const;
310
311 /// Gets the type ID of the associated Slice interface.
312 /// @return The string `"::Glacier2::PermissionsVerifier"`.
313 static const char* ice_staticId() noexcept;
314 };
315
316 /// A shared pointer to a PermissionsVerifier.
318
319 /// Represents an object that checks user permissions. The Glacier2 router and other services use an
320 /// SSLPermissionsVerifierPrx proxy when the user is authenticated through an SSL certificate.
321 /// @headerfile Glacier2/Glacier2.h
322 class GLACIER2_API SSLPermissionsVerifier : public virtual Ice::Object
323 {
324 public:
325 /// The associated proxy type.
327
328 /// Dispatches an incoming request to one of the member functions of this generated class, based on the operation name carried by the request.
329 /// @param request The incoming request.
330 /// @param sendResponse The callback to send the response.
331 void dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse) override;
332
333 [[nodiscard]] std::vector<std::string> ice_ids(const Ice::Current& current) const override;
334
335 [[nodiscard]] std::string ice_id(const Ice::Current& current) const override;
336
337 /// Checks if a user is authorized to establish a session.
338 /// @param info The SSL information.
339 /// @param[out] reason The reason why access was denied.
340 /// @param current The Current object of the incoming request.
341 /// @return `true` if access is granted, `false` otherwise.
342 /// @throws Glacier2::PermissionDeniedException Thrown when the user's access is denied. This exception can be thrown
343 /// instead of returning `false` with a reason set in the reason out parameter.
344 virtual bool authorize(SSLInfo info, std::string& reason, const Ice::Current& current) const = 0;
345
346 /// @private
347 void _iceD_authorize(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>) const;
348
349 /// Gets the type ID of the associated Slice interface.
350 /// @return The string `"::Glacier2::SSLPermissionsVerifier"`.
351 static const char* ice_staticId() noexcept;
352 };
353
354 /// A shared pointer to a SSLPermissionsVerifier.
356}
357
358// NOLINTEND(modernize-concat-nested-namespaces)
359
360#include <Ice/PopDisableWarnings.h>
361#endif
std::string reason
The reason why permission was denied.
const char * ice_id() const noexcept override
Returns the type ID of this exception.
std::tuple< const std::string & > ice_tuple() const
Creates a tuple with all the fields of this exception.
static const char * ice_staticId() noexcept
Gets the type ID of the associated Slice exception.
void ice_throw() const override
Throws this exception.
void ice_printFields(std::ostream &os) const override
Outputs the name and value of each field of this instance, including inherited fields,...
PermissionDeniedException(const PermissionDeniedException &) noexcept=default
Copy constructor.
PermissionDeniedException() noexcept=default
Default constructor.
PermissionsVerifierPrx(const Ice::CommunicatorPtr &communicator, std::string_view proxyString)
Constructs a proxy from a Communicator and a proxy string.
std::function< void()> checkPermissionsAsync(std::string_view userId, std::string_view password, std::function< void(bool, std::string)> response, std::function< void(std::exception_ptr)> exception=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Checks if a user is authorized to establish a session.
PermissionsVerifierPrx & operator=(PermissionsVerifierPrx &&rhs) noexcept
Move assignment operator.
std::future< std::tuple< bool, std::string > > checkPermissionsAsync(std::string_view userId, std::string_view password, const Ice::Context &context=Ice::noExplicitContext) const
Checks if a user is authorized to establish a session.
PermissionsVerifierPrx & operator=(const PermissionsVerifierPrx &rhs) noexcept
Copy assignment operator.
static const char * ice_staticId() noexcept
Gets the type ID of the associated Slice interface.
PermissionsVerifierPrx(const PermissionsVerifierPrx &other) noexcept
Copy constructor.
PermissionsVerifierPrx(PermissionsVerifierPrx &&other) noexcept
Move constructor.
bool checkPermissions(std::string_view userId, std::string_view password, std::string &reason, const Ice::Context &context=Ice::noExplicitContext) const
Checks if a user is authorized to establish a session.
Represents an object that checks user permissions.
void dispatch(Ice::IncomingRequest &request, std::function< void(Ice::OutgoingResponse)> sendResponse) override
Dispatches an incoming request to one of the member functions of this generated class,...
std::vector< std::string > ice_ids(const Ice::Current &current) const override
Gets the Slice interfaces supported by this object as a list of type IDs.
PermissionsVerifierPrx ProxyType
The associated proxy type.
static const char * ice_staticId() noexcept
Gets the type ID of the associated Slice interface.
std::string ice_id(const Ice::Current &current) const override
Gets the type ID of the most-derived Slice interface supported by this object.
virtual bool checkPermissions(std::string userId, std::string password, std::string &reason, const Ice::Current &current) const =0
Checks if a user is authorized to establish a session.
Represents an object that checks user permissions.
SSLPermissionsVerifierPrx & operator=(const SSLPermissionsVerifierPrx &rhs) noexcept
Copy assignment operator.
static const char * ice_staticId() noexcept
Gets the type ID of the associated Slice interface.
std::function< void()> authorizeAsync(const SSLInfo &info, std::function< void(bool, std::string)> response, std::function< void(std::exception_ptr)> exception=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Checks if a user is authorized to establish a session.
bool authorize(const SSLInfo &info, std::string &reason, const Ice::Context &context=Ice::noExplicitContext) const
Checks if a user is authorized to establish a session.
SSLPermissionsVerifierPrx(const Ice::CommunicatorPtr &communicator, std::string_view proxyString)
Constructs a proxy from a Communicator and a proxy string.
std::future< std::tuple< bool, std::string > > authorizeAsync(const SSLInfo &info, const Ice::Context &context=Ice::noExplicitContext) const
Checks if a user is authorized to establish a session.
SSLPermissionsVerifierPrx(const SSLPermissionsVerifierPrx &other) noexcept
Copy constructor.
SSLPermissionsVerifierPrx & operator=(SSLPermissionsVerifierPrx &&rhs) noexcept
Move assignment operator.
SSLPermissionsVerifierPrx(SSLPermissionsVerifierPrx &&other) noexcept
Move constructor.
Represents an object that checks user permissions.
static const char * ice_staticId() noexcept
Gets the type ID of the associated Slice interface.
SSLPermissionsVerifierPrx ProxyType
The associated proxy type.
virtual bool authorize(SSLInfo info, std::string &reason, const Ice::Current &current) const =0
Checks if a user is authorized to establish a session.
std::string ice_id(const Ice::Current &current) const override
Gets the type ID of the most-derived Slice interface supported by this object.
void dispatch(Ice::IncomingRequest &request, std::function< void(Ice::OutgoingResponse)> sendResponse) override
Dispatches an incoming request to one of the member functions of this generated class,...
std::vector< std::string > ice_ids(const Ice::Current &current) const override
Gets the Slice interfaces supported by this object as a list of type IDs.
Represents an object that checks user permissions.
Represents a request received by a connection.
ObjectPrx & operator=(const ObjectPrx &rhs) noexcept=default
Copy assignment operator.
The base class for all Ice proxies.
Definition Proxy.h:232
Object() noexcept=default
Default constructor.
The base class for servants.
Definition Object.h:21
Represents the response to an incoming request.
Provides typed proxy functions.
Definition Proxy.h:45
Abstract base class for all Ice exceptions defined in Slice.
std::shared_ptr< SSLPermissionsVerifier > SSLPermissionsVerifierPtr
A shared pointer to a SSLPermissionsVerifier.
std::shared_ptr< PermissionsVerifier > PermissionsVerifierPtr
A shared pointer to a PermissionsVerifier.
Communicate through firewalls and across NATs.
std::shared_ptr< Communicator > CommunicatorPtr
A shared pointer to a Communicator.
const Context noExplicitContext
Marker value used to indicate that no explicit request context was passed to a proxy invocation.
std::map< std::string, std::string, std::less<> > Context
Represents additional information carried by an Ice request.
Definition Context.h:28
The Ice RPC framework.
Definition SampleEvent.h:59
Represents information gathered from an incoming SSL connection and used for authentication and autho...
Definition SSLInfo.h:42
Provides information about an incoming request being dispatched.
Definition Current.h:18