summaryrefslogtreecommitdiffstats
blob: 027bc89473b7d540a446ee764769ec73fe31c3c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright (c) 2012 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#include <Swiften/SASL/EXTERNALClientAuthenticator.h>

namespace Swift {

EXTERNALClientAuthenticator::EXTERNALClientAuthenticator() : ClientAuthenticator("EXTERNAL"), finished(false) {
}

boost::optional<SafeByteArray> EXTERNALClientAuthenticator::getResponse() const {
    const std::string& authorizationID = getAuthorizationID();

    if (authorizationID.empty()) {
        return boost::optional<SafeByteArray>();
    } else {
        return createSafeByteArray(authorizationID);
    }
}

bool EXTERNALClientAuthenticator::setChallenge(const boost::optional<ByteArray>&) {
    if (finished) {
        return false;
    }
    finished = true;
    return true;
}

}