oauth2_id_token_decoder.h 896 B

12345678910111213141516171819202122232425262728
  1. // Copyright (c) 2017 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 GOOGLE_APIS_GAIA_OAUTH2_ID_TOKEN_DECODER_H_
  5. #define GOOGLE_APIS_GAIA_OAUTH2_ID_TOKEN_DECODER_H_
  6. #include <string>
  7. #include <vector>
  8. // This file holds methods decodes the id token received for OAuth2 token
  9. // endpoint, and derive useful information from it, such as whether the account
  10. // is a child account, and whether this account is under advanced protection.
  11. namespace gaia {
  12. // Service flags extracted from ID token.
  13. struct TokenServiceFlags {
  14. bool is_child_account = false;
  15. bool is_under_advanced_protection = false;
  16. };
  17. // Parses service flag from ID token.
  18. TokenServiceFlags ParseServiceFlags(const std::string& id_token);
  19. } // namespace gaia
  20. #endif // GOOGLE_APIS_GAIA_OAUTH2_ID_TOKEN_DECODER_H_