Sirikata
libcore/include/sirikata/core/transfer/OAuthParams.hpp
Go to the documentation of this file.
00001 // Copyright (c) 2011 Sirikata Authors. All rights reserved.
00002 // Use of this source code is governed by a BSD-style license that can
00003 // be found in the LICENSE file.
00004 
00005 #ifndef _SIRIKATA_LIBCORE_OAUTH_PARAMS_HPP_
00006 #define _SIRIKATA_LIBCORE_OAUTH_PARAMS_HPP_
00007 
00008 #include <sirikata/core/util/Platform.hpp>
00009 #include <liboauthcpp/liboauthcpp.h>
00010 
00011 namespace Sirikata {
00012 namespace Transfer {
00013 
00015 class SIRIKATA_EXPORT OAuthParams {
00016   public:
00017     OAuthParams(const String& hostname_, const String& service_, const String& consumer_key, const String& consumer_secret)
00018      : hostname(hostname_), service(service_),
00019        consumer(consumer_key, consumer_secret),
00020        token("", "")
00021     {}
00022 
00023     OAuthParams(const String& hostname_, const String& service_, const String& consumer_key, const String& consumer_secret, const String& token_key, const String& token_secret)
00024      : hostname(hostname_), service(service_),
00025        consumer(consumer_key, consumer_secret),
00026        token(token_key, token_secret)
00027     {}
00028 
00029     const OAuth::Consumer* consumerPtr() const { return &consumer; }
00030     const OAuth::Token* tokenPtr() const { return (token.key().empty() && token.secret().empty()) ? NULL : &token; }
00031 
00032     const String hostname;
00033     const String service;
00034     const OAuth::Consumer consumer;
00035     const OAuth::Token token;
00036 };
00037 typedef std::tr1::shared_ptr<OAuthParams> OAuthParamsPtr;
00038 
00039 } // namespace Transfer
00040 } // namespace Sirikata
00041 
00042 #endif //_SIRIKATA_LIBCORE_OAUTH_HTTP_MANAGER_HPP_