xentara-plugin v2.0.4
The Xentara Plugin Framework
|
An OAuth 2.0 scope, consisting of a list of scope strings. More...
#include <xentara/security/Oauth2Scope.hpp>
Public Member Functions | |
Oauth2Scope ()=default | |
Default constructor. | |
Oauth2Scope (std::vector< std::string > scopeStrings) | |
Constructor that constructs a valid scope from a list of scope strings. | |
operator bool () const noexcept | |
Determines if the scope contains any scope strings. | |
internal auto | operator== (const Oauth2Scope &scope) const noexcept -> bool=default |
Compares two scopes to check whether they are the same. | |
auto | load (utils::json::decoder::Value &value) -> void |
Loads the scope from a configuration value. | |
template<utils::tools::CharType Char, typename CharTraits = std::char_traits<Char>> | |
auto | toBasicString () const -> std::basic_string< Char, CharTraits > |
Converts the scope to a string. | |
auto | toString () const -> std::string |
Converts the scope to a string of type char. | |
auto | toWString () const -> std::wstring |
Converts the scope to a string of type wchar_t. | |
auto | toU8String () const -> std::u8string |
Converts the scope to a string of type char8_t. | |
auto | toU16String () const -> std::u16string |
Converts the scope to a string of type char16_t. | |
auto | toU32String () const -> std::u32string |
Converts the scope to a string of type char32_t. | |
Static Public Member Functions | |
static internal auto | checkScopeString (std::string_view string) -> utils::eh::expected< void, std::string_view > |
Checks whether a string is a legal OAuth 2.0 scope string. | |
An OAuth 2.0 scope, consisting of a list of scope strings.
|
default |
Default constructor.
This constructor constructs an empty scope that contains no scope strings. If you use such a scope, the default scope configured in the Xentara OAuth 2.0 configuration will be used.
xentara::security::Oauth2Scope::Oauth2Scope | ( | std::vector< std::string > | scopeStrings | ) |
Constructor that constructs a valid scope from a list of scope strings.
scopeStrings | The list of scope strings. Must be a non-empty list of valid OAuth 2.0 scope strings. You can use checkScopeString() to check the scope strings for validity. The order of the scope strings is not relevant, and duplicate scope strings are removed. |
std::invalid_argument | scopeStrings is an empty list. |
std::invalid_argument | scopeStrings contains a string that is not a valid OAuth 2.0 scope string. |
|
static |
Checks whether a string is a legal OAuth 2.0 scope string.
string | The string to check |
auto xentara::security::Oauth2Scope::load | ( | utils::json::decoder::Value & | value | ) | -> void |
Loads the scope from a configuration value.
value | The value to load the configuration from |
std::runtime_error | The configuration is not valid, or another error occurred. |
|
explicitnoexcept |
Determines if the scope contains any scope strings.
|
defaultnoexcept |
Compares two scopes to check whether they are the same.
auto xentara::security::Oauth2Scope::toBasicString | ( | ) | const -> std::basic_string<Char, CharTraits> |
Converts the scope to a string.
auto xentara::security::Oauth2Scope::toString | ( | ) | const -> std::string |
Converts the scope to a string of type char.
auto xentara::security::Oauth2Scope::toU16String | ( | ) | const -> std::u16string |
Converts the scope to a string of type char16_t.
auto xentara::security::Oauth2Scope::toU32String | ( | ) | const -> std::u32string |
Converts the scope to a string of type char32_t.
auto xentara::security::Oauth2Scope::toU8String | ( | ) | const -> std::u8string |
Converts the scope to a string of type char8_t.
auto xentara::security::Oauth2Scope::toWString | ( | ) | const -> std::wstring |
Converts the scope to a string of type wchar_t.