Qpid Proton C++  0.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
sasl.hpp
1 #ifndef PROTON_CPP_SASL_H
2 #define PROTON_CPP_SASL_H
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 "proton/export.hpp"
26 #include "proton/sasl.h"
27 #include <string>
28 
29 namespace proton {
30 
32 class sasl {
33  public:
35  enum outcome {
36  NONE = PN_SASL_NONE,
37  OK = PN_SASL_OK,
38  AUTH = PN_SASL_AUTH,
39  SYS = PN_SASL_SYS,
40  PERM = PN_SASL_PERM,
41  TEMP = PN_SASL_TEMP
42  };
43 
46  sasl(pn_sasl_t* s) : object_(s) {}
47  PN_CPP_EXTERN static bool extended();
48  PN_CPP_EXTERN void done(enum outcome);
50 
52  PN_CPP_EXTERN enum outcome outcome() const;
53 
55  PN_CPP_EXTERN std::string user() const;
56 
58  PN_CPP_EXTERN std::string mech() const;
59 
61  PN_CPP_EXTERN void allow_insecure_mechs(bool);
63 
65  PN_CPP_EXTERN bool allow_insecure_mechs();
66 
69  PN_CPP_EXTERN void allowed_mechs(const std::string &);
70  PN_CPP_EXTERN void config_name(const std::string&);
71  PN_CPP_EXTERN void config_path(const std::string&);
73 private:
74  pn_sasl_t* object_;
75 };
76 
77 }
78 
79 #endif // PROTON_CPP_SASL_H
Failed due to a system error.
Definition: sasl.hpp:39
Failed due to unrecoverable error.
Definition: sasl.hpp:40
SASL information.
Definition: sasl.hpp:32
Failed due to bad credentials.
Definition: sasl.hpp:38
bool allow_insecure_mechs()
True if insecure mechanisms are permitted.
Authentication succeeded.
Definition: sasl.hpp:37
Failed due to transient error.
Definition: sasl.hpp:41
Negotiation not completed.
Definition: sasl.hpp:36
std::string mech() const
Get the mechanism.
std::string user() const
Get the user name.
outcome
The result of the SASL negotiation.
Definition: sasl.hpp:35
enum outcome outcome() const
Get the outcome.