Stroika Library 3.0d23
 
Loading...
Searching...
No Matches
Auth/Interceptor.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4
7
8namespace Stroika::Frameworks::Auth {
9
10 /*
11 ********************************************************************************
12 ***************** Auth::CurrentIdentityAuthInterceptor *************************
13 ********************************************************************************
14 */
15 template <IIdentityManagerCompatibleID ID_TYPE>
16 struct CurrentIdentityAuthInterceptor<ID_TYPE>::Rep_ : Interceptor::_IRep {
17 function<ID_TYPE (WebServer::Request&)> fCallback_;
18
19 Rep_ (function<ID_TYPE (WebServer::Request&)> cb)
20 : fCallback_{cb}
21 {
22 }
23 virtual void HandleFault ([[maybe_unused]] WebServer::Message& m, [[maybe_unused]] const exception_ptr& e) const noexcept override
24 {
25 CurrentIdentityManager<ID_TYPE>::clear ();
26 }
27 virtual void HandleMessage (WebServer::Message& m) const override
28 {
29 if (auto oId = fCallback_ (m.rwRequest ())) {
31 }
32 }
33 virtual void CompleteNormally ([[maybe_unused]] WebServer::Message& m) const override
34 {
35 CurrentIdentityManager<ID_TYPE>::clear ();
36 }
37 virtual Characters::String ToString () const override
38 {
39 return "CurrentIdentityAuthInterceptor"sv;
40 }
41 };
42 template <IIdentityManagerCompatibleID ID_TYPE>
43 CurrentIdentityAuthInterceptor<ID_TYPE>::CurrentIdentityAuthInterceptor (function<ID_TYPE (WebServer::Request&)> cb)
44 : inherited{Memory::MakeSharedPtr<Rep_> (cb)}
45 {
46 }
47
48}
auto MakeSharedPtr(ARGS_TYPE &&... args) -> shared_ptr< T >
same as make_shared, but if type T has block allocation, then use block allocation for the 'shared pa...
nonvirtual void HandleFault(Message &m, const exception_ptr &e) const noexcept
nonvirtual void HandleMessage(Message &m) const
static void Set(IDType id)
if no identity set with Establish, and maybe even if it has been set, Get() == false