in_session_auth.mojom 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. module crosapi.mojom;
  5. import "mojo/public/mojom/base/time.mojom";
  6. [Stable]
  7. struct RequestTokenReply {
  8. // The authentication token that is returned, to use for sensitive
  9. // operations.
  10. string token@0;
  11. // The length of time for which the token is valid.
  12. mojo_base.mojom.TimeDelta timeout@1;
  13. };
  14. [Stable, Extensible]
  15. enum Reason {
  16. [Default] kAccessPasswordManager = 0,
  17. kModifyAuthFactors,
  18. kModifyAuthFactorsMultidevice,
  19. };
  20. // An interface implemented by Ash to expose Ash's authentication capabilities.
  21. // Used by Lacros for extension API authentication in Settings.
  22. [Stable, Uuid="7d4bb0d8-f1fa-46bf-a7a6-b7117526ea63"]
  23. interface InSessionAuth {
  24. // Instructs Ash to summon a native authentication dialog to authenticate
  25. // the currently active user. Returns a prerishable authentication token on
  26. // success. RequestTokenReply in null if authentication was aborted.
  27. RequestToken@0(Reason reason) => (RequestTokenReply? reply);
  28. // Check the validity of the token for sensitive operations.
  29. CheckToken@1(Reason reason, string token) => (bool valid);
  30. // Release the token when no longer needed, rendering it invalid.
  31. InvalidateToken@2(string token);
  32. };