in_session_auth_token_provider.h 1020 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_PUBLIC_CPP_IN_SESSION_AUTH_TOKEN_PROVIDER_H_
  5. #define ASH_PUBLIC_CPP_IN_SESSION_AUTH_TOKEN_PROVIDER_H_
  6. #include "ash/components/login/auth/public/user_context.h"
  7. #include "ash/public/cpp/ash_public_export.h"
  8. #include "base/callback_forward.h"
  9. #include "base/time/time.h"
  10. #include "base/unguessable_token.h"
  11. namespace ash {
  12. class ASH_PUBLIC_EXPORT InSessionAuthTokenProvider {
  13. public:
  14. using OnAuthTokenGenerated =
  15. base::OnceCallback<void(const base::UnguessableToken&, base::TimeDelta)>;
  16. virtual ~InSessionAuthTokenProvider() = default;
  17. // Constructs an unguessable token for a given `UserContext`
  18. virtual void ExchangeForToken(std::unique_ptr<UserContext> user_context,
  19. OnAuthTokenGenerated callback) = 0;
  20. };
  21. } // namespace ash
  22. #endif // ASH_PUBLIC_CPP_IN_SESSION_AUTH_TOKEN_PROVIDER_H_