-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibtouchstone.h
More file actions
28 lines (22 loc) · 875 Bytes
/
libtouchstone.h
File metadata and controls
28 lines (22 loc) · 875 Bytes
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
#pragma once
#include <cpr/cpr.h>
namespace libtouchstone {
struct AuthOptions {
const char* cookie_file = "cookies.txt";
bool verbose = false;
bool block = true; // false = error instead of waiting for 2FA
int twofactor = 0; // 0 = Duo Push, 1 = Phone Call (not implemented currently)
};
// Create a session configured for Touchstone auth with cookie persistence.
cpr::Session session(const char* cookie_file = "cookies.txt");
// Authenticate to a Touchstone-protected URL.
// Uses the provided session (which can be reused for subsequent requests).
// On success: response has target page, session retains auth cookies.
// On error: response.error is set.
cpr::Response authenticate(
cpr::Session& s,
const char* url,
const char* username,
const char* password,
const AuthOptions& opts = {});
} // namespace libtouchstone