1#ifndef LIBFILEZILLA_IMPERSONATION_HEADER
2#define LIBFILEZILLA_IMPERSONATION_HEADER
15#include "glue/windows.hpp"
29 bool drop_admin_privileges =
true;
36class impersonation_token_impl;
46class FZ_PUBLIC_SYMBOL impersonation_token final
49 impersonation_token();
51 impersonation_token(impersonation_token&&)
noexcept;
52 impersonation_token& operator=(impersonation_token&&)
noexcept;
58 ~impersonation_token() noexcept;
60 explicit operator
bool()
const {
61 return impl_.operator bool();
64 bool operator==(impersonation_token
const&)
const;
65 bool operator<(impersonation_token
const&)
const;
74 std::size_t
hash() const noexcept;
77 std::
string uid() const;
82 friend class impersonation_token_impl;
83 std::unique_ptr<impersonation_token_impl> impl_;
88bool FZ_PUBLIC_SYMBOL set_process_impersonation(impersonation_token
const& token);
104struct hash<
fz::impersonation_token>
Impersonation tokens for a given user can be used to spawn processes running as that user.
Definition impersonation.hpp:47
std::string uid() const
A opaque unique identifier.
impersonation_token(fz::native_string const &username, fz::native_string const &password, fz::logger_interface &logger=get_null_logger(), impersonation_options const &opts={})
Creates an impersonation token, verifying credentials in the process.
fz::native_string home() const
Returns home directory, may be empty.
fz::native_string username() const
Returns the name of the impersonated user.
std::size_t hash() const noexcept
For std::hash.
Abstract interface for logging strings.
Definition logger.hpp:51
The namespace used by libfilezilla.
Definition apply.hpp:17
std::string get_user_uid(native_string const &username)
native_string current_username()
Returns the username the calling thread is running under.
std::wstring native_string
A string in the system's native character type and encoding. Note: This typedef changes depending on...
Definition string.hpp:69
bool operator==(symmetric_key const &lhs, symmetric_key const &rhs)
Side-channel safe comparison.
String types and assorted functions.
Impersonate as any user without checking credentials.
Definition impersonation.hpp:25
Definition impersonation.hpp:23