Qpid Proton C++ API  0.38.0
sasl.hpp
Go to the documentation of this file.
1 #ifndef PROTON_SASL_HPP
2 #define PROTON_SASL_HPP
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
25 #include "./internal/export.hpp"
26 #include "./internal/object.hpp"
27 
28 #include <proton/sasl.h>
29 
30 #include <string>
31 
34 
35 namespace proton {
36 
38 class sasl {
40  sasl(pn_sasl_t* s) : object_(s) {}
42 
43  sasl() = delete;
44 
45  public:
47  enum outcome {
48  NONE = PN_SASL_NONE,
49  OK = PN_SASL_OK,
50  AUTH = PN_SASL_AUTH,
51  SYS = PN_SASL_SYS,
52  PERM = PN_SASL_PERM,
53  TEMP = PN_SASL_TEMP
54  };
55 
57  PN_CPP_EXTERN enum outcome outcome() const;
58 
60  PN_CPP_EXTERN std::string user() const;
61 
63  PN_CPP_EXTERN std::string mech() const;
64 
66  private:
67  pn_sasl_t* const object_;
68 
69  friend class transport;
71 };
72 
73 } // proton
74 
75 #endif // PROTON_SASL_HPP
SASL information.
Definition: sasl.hpp:38
std::string user() const
Get the user name.
std::string mech() const
Get the mechanism.
outcome
The result of the SASL negotiation.
Definition: sasl.hpp:47
@ OK
Authentication succeeded.
Definition: sasl.hpp:49
@ TEMP
Failed due to transient error.
Definition: sasl.hpp:53
@ SYS
Failed due to a system error.
Definition: sasl.hpp:51
@ AUTH
Failed due to bad credentials.
Definition: sasl.hpp:50
@ NONE
Negotiation not completed.
Definition: sasl.hpp:48
@ PERM
Failed due to unrecoverable error.
Definition: sasl.hpp:52
A network channel supporting an AMQP connection.
Definition: transport.hpp:37
The main Proton namespace.
Definition: annotation_key.hpp:33