/* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include #include #include #include namespace Swift { AuthChallengeSerializer::AuthChallengeSerializer() { } SafeByteArray AuthChallengeSerializer::serialize(std::shared_ptr element) const { std::shared_ptr authChallenge(std::dynamic_pointer_cast(element)); std::string value; boost::optional > message = authChallenge->getValue(); if (message) { if ((*message).empty()) { value = "="; } else { value = Base64::encode(ByteArray(*message)); } } return createSafeByteArray("" + value + ""); } }