6#include <userver/server/request/request_context.hpp>
7#include <userver/utils/strong_typedef.hpp>
9#include <userver/server/auth/user_env.hpp>
10#include <userver/server/auth/user_id.hpp>
11#include <userver/server/auth/user_provider.hpp>
12#include <userver/server/auth/user_scopes.hpp>
14USERVER_NAMESPACE_BEGIN
16namespace server::handlers::
auth {
20namespace server::auth {
22class UserAuthInfo
final {
24 using Ticket = utils::NonLoggable<
class TicketTag, std::string>;
26 UserAuthInfo(UserId default_id, UserEnv env, UserProvider provider);
27 UserAuthInfo(UserId default_id, Ticket user_ticket, UserEnv env,
28 UserProvider provider);
30 UserAuthInfo(UserId default_id, UserIds ids, UserScopes scopes, UserEnv env,
31 UserProvider provider);
32 UserAuthInfo(UserId default_id, UserIds ids, UserScopes scopes,
33 Ticket user_ticket, UserEnv env, UserProvider provider);
35 UserId GetDefaultUserId()
const;
36 const UserIds& GetUserIds()
const;
37 const std::optional<UserScopes>& GetUserScopesOptional()
const;
38 const std::optional<Ticket>& GetTicketOptional()
const;
39 UserEnv GetUserEnv()
const {
return user_env_; }
40 UserProvider GetUserProvider()
const {
return user_provider_; }
44 static void Set(server::
request::RequestContext& request_context,
49 std::optional<UserScopes> scopes_;
50 std::optional<Ticket> user_ticket_;
52 UserProvider user_provider_;
55const UserAuthInfo& GetUserAuthInfo(
56 const server::
request::RequestContext& request_context);