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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
+
+
-
+
-
+
-
+
-
-
+
+
-
-
-
+
+
+
-
+
-
+
+
+
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#import <ObjFW/ObjFW.h>
OF_ASSUME_NONNULL_BEGIN
/**
* \brief A base class for classes implementing authentication mechanisms
*/
@interface XMPPAuthenticator: OFObject
{
OFString *_authzid, *_authcid, *_password;
}
/// \brief The authzid to get authorization for
@property (copy) OFString *authzid;
@property OF_NULLABLE_PROPERTY (nonatomic, copy) OFString *authzid;
/// \brief The authcid to authenticate with
@property (copy) OFString *authcid;
@property OF_NULLABLE_PROPERTY (nonatomic, copy) OFString *authcid;
/// \brief The password to authenticate with
@property (copy) OFString *password;
@property OF_NULLABLE_PROPERTY (nonatomic, copy) OFString *password;
/**
* \brief Initializes an already allocated XMPPAuthenticator with an authcid
* and password.
*
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \return A initialized XMPPAuthenticator
*/
- initWithAuthcid: (OFString*)authcid
password: (OFString*)password;
- initWithAuthcid: (nullable OFString *)authcid
password: (nullable OFString *)password;
/**
* \brief Initializes an already allocated XMPPSCRAMAuthenticator with an
* authzid, authcid and password.
*
* \param authzid The authzid to get authorization for
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \return A initialized XMPPAuthenticator
*/
- initWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password;
- initWithAuthzid: (nullable OFString *)authzid
authcid: (nullable OFString *)authcid
password: (nullable OFString *)password OF_DESIGNATED_INITIALIZER;
/**
* \brief Returns an OFDataArray containing the initial authentication message.
*
* \return An OFDataAray containing the initial authentication message
*/
- (OFDataArray*)initialMessage;
- (OFDataArray *)initialMessage;
/**
* \brief Continue authentication with the specified data.
*
* \param data The continuation data send by the server
* \return The appropriate response if the data was a challenge, nil otherwise
*/
- (OFDataArray*)continueWithData: (OFDataArray*)data;
- (nullable OFDataArray *)continueWithData: (OFDataArray *)data;
@end
OF_ASSUME_NONNULL_END
|