/mordor/http/basic.cpp
http://github.com/mozy/mordor · C++ · 27 lines · 19 code · 7 blank · 1 comment · 0 complexity · 065ec957e0eb875054f9dd2daa745738 MD5 · raw file
- // Copyright (c) 2009 - Mozy, Inc.
- #include "basic.h"
- #include "http.h"
- #include "mordor/string.h"
- namespace Mordor {
- namespace HTTP {
- namespace BasicAuth {
- void authorize(AuthParams &authorization, const std::string &username,
- const std::string &password)
- {
- authorization.scheme = "Basic";
- authorization.param = base64encode(username + ":" + password);
- authorization.parameters.clear();
- }
- void authorize(Request &nextRequest,
- const std::string &username, const std::string &password,
- bool proxy)
- { authorize(proxy ? nextRequest.request.proxyAuthorization :
- nextRequest.request.authorization, username, password); }
- }}}