Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
citizen:server:
msec
changes, support license
identifier type, de…
…terministic identifier ordering
- Loading branch information
1 parent
5d8265c
commit dd42666
Showing
9 changed files
with
161 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,4 @@ static InitFunction initFunction([]() | |
} idp; | ||
|
||
fx::RegisterServerIdentityProvider(&idp); | ||
}); | ||
}, 150); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
code/components/citizen-server-impl/src/LicenseIdentityProvider.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* This file is part of FiveM: https://fivem.net/ | ||
* | ||
* See LICENSE and MENTIONS in the root of the source tree for information | ||
* regarding licensing. | ||
*/ | ||
|
||
#include "StdInc.h" | ||
#include <ServerIdentityProvider.h> | ||
|
||
static InitFunction initFunction([]() | ||
{ | ||
static struct LicenseIdProvider : public fx::ServerIdentityProviderBase | ||
{ | ||
virtual std::string GetIdentifierPrefix() override | ||
{ | ||
return "license"; | ||
} | ||
|
||
virtual int GetVarianceLevel() override | ||
{ | ||
return 1; | ||
} | ||
|
||
virtual int GetTrustLevel() override | ||
{ | ||
return 5; | ||
} | ||
|
||
virtual void RunAuthentication(const std::shared_ptr<fx::Client>& clientPtr, const std::map<std::string, std::string>& postMap, const std::function<void(std::optional<std::string>)>& cb) override | ||
{ | ||
auto& any = clientPtr->GetData("entitlementHash"); | ||
|
||
if (any.has_value()) | ||
{ | ||
clientPtr->AddIdentifier(fmt::sprintf("license:%s", std::any_cast<std::string>(any))); | ||
} | ||
|
||
cb({}); | ||
} | ||
} idp; | ||
|
||
fx::RegisterServerIdentityProvider(&idp); | ||
}, 151); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,4 +85,4 @@ static InitFunction initFunction([]() | |
} idp; | ||
|
||
fx::RegisterServerIdentityProvider(&idp); | ||
}); | ||
}, 152); |