Skip to content

Commit 3966dfb

Browse files
committed
feat: Add oauth.
1 parent ea10f03 commit 3966dfb

File tree

6 files changed

+997
-0
lines changed

6 files changed

+997
-0
lines changed

CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,30 @@ if(AGENT_CPP_BUILD_MCP)
9999
message(STATUS "MCP client enabled (using cpp-httplib)")
100100
endif()
101101

102+
# OAuth library for handling OAuth 2.0 authorization flows
103+
option(AGENT_CPP_BUILD_OAUTH "Build OAuth client (requires OpenSSL)" OFF)
104+
105+
if(AGENT_CPP_BUILD_OAUTH)
106+
find_package(OpenSSL REQUIRED)
107+
108+
add_library(oauth STATIC
109+
src/oauth/oauth.cpp
110+
src/oauth/token_storage.cpp
111+
)
112+
add_library(agent-cpp::oauth ALIAS oauth)
113+
target_include_directories(oauth
114+
PUBLIC
115+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
116+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/cpp-httplib>
117+
$<BUILD_INTERFACE:${LLAMA_SOURCE_DIR}/common>
118+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/agent-cpp>
119+
)
120+
target_link_libraries(oauth PUBLIC common OpenSSL::SSL OpenSSL::Crypto)
121+
target_compile_features(oauth PUBLIC cxx_std_17)
122+
123+
message(STATUS "OAuth client enabled (using cpp-httplib)")
124+
endif()
125+
102126
if(AGENT_CPP_BUILD_TESTS)
103127
enable_testing()
104128

0 commit comments

Comments
 (0)