PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
psasl.h
Go to the documentation of this file.
1 /*
2  * sasl.h
3  *
4  * Simple Authentication Security Layer interface classes
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 2004 Reitek S.p.A.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Post Increment
23  *
24  * Contributor(s): ______________________________________.
25  */
26 
27 #ifndef PTLIB_PSASL_H
28 #define PTLIB_PSASL_H
29 
30 #if P_SASL
31 
32 #ifdef P_USE_PRAGMA
33 #pragma interface
34 #endif
35 
36 #include <ptlib.h>
37 
38 class PSASLClient : public PObject
39 {
40  PCLASSINFO(PSASLClient, PObject);
41 
42 public:
43  enum PSASLResult {
44  Continue = 1,
45  OK = 0,
46  Fail = -1
47  };
48 
49 protected:
50  static PString s_Realm;
51  static PString s_Path;
52 
53  struct sasl_callback * m_CallBacks;
54  struct sasl_conn * m_ConnState;
55 
60 
61  PBoolean Start(const PString& mechanism, const char ** output, unsigned& len);
62  PSASLResult Negotiate(const char * input, const char ** output);
63 
64 public:
65  PSASLClient(const PString& service, const PString& uid, const PString& auth, const PString& pwd);
66  ~PSASLClient();
67 
68  static void SetRealm(const PString& realm) { s_Realm = realm; }
69  static void SetPath(const PString& path) { s_Path = path; }
70 
71  static const PString& GetRealm() { return s_Realm; }
72  static const PString& GetPath() { return s_Path; }
73 
74  const PString& GetService() const { return m_Service; }
75  const PString& GetUserID() const { return m_UserID; }
76  const PString& GetAuthID() const { return m_AuthID; }
77  const PString& GetPassword() const { return m_Password; }
78 
79  PBoolean Init(const PString& fqdn, PStringSet& supportedMechanisms);
80  PBoolean Start(const PString& mechanism, PString& output);
81  PSASLResult Negotiate(const PString& input, PString& output);
82  PBoolean End();
83 };
84 
85 #endif // P_SASL
86 
87 #endif // PTLIB_PSASL_H
88 
89 
90 // End of File ///////////////////////////////////////////////////////////////
static void SetPath(const PString &path)
Definition: psasl.h:69
static void SetRealm(const PString &realm)
Definition: psasl.h:68
PSASLResult
Definition: psasl.h:43
static const PString & GetPath()
Definition: psasl.h:72
const PString m_Service
Definition: psasl.h:56
const PString & GetAuthID() const
Definition: psasl.h:76
static PString s_Path
Definition: psasl.h:51
Definition: psasl.h:45
PSASLResult Negotiate(const char *input, const char **output)
struct sasl_callback * m_CallBacks
Definition: psasl.h:53
const PString & GetUserID() const
Definition: psasl.h:75
PSASLClient(const PString &service, const PString &uid, const PString &auth, const PString &pwd)
const PString m_Password
Definition: psasl.h:59
Definition: psasl.h:46
bool PBoolean
Definition: object.h:174
The character string class.
Definition: pstring.h:108
This is a set collection class of PString objects.
Definition: pstring.h:2821
Definition: psasl.h:38
Definition: psasl.h:44
const PString & GetPassword() const
Definition: psasl.h:77
static PString s_Realm
Definition: psasl.h:50
PBoolean Init(const PString &fqdn, PStringSet &supportedMechanisms)
const PString m_UserID
Definition: psasl.h:57
const PString & GetService() const
Definition: psasl.h:74
static const PString & GetRealm()
Definition: psasl.h:71
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
PBoolean End()
const PString m_AuthID
Definition: psasl.h:58
struct sasl_conn * m_ConnState
Definition: psasl.h:54
PBoolean Start(const PString &mechanism, const char **output, unsigned &len)