From 308acc09bfaf6dabf4b6d5f5e39f33854df8ce34 Mon Sep 17 00:00:00 2001 From: rsgowman Date: Wed, 21 Mar 2018 11:04:40 -0400 Subject: Change CredentialsProvider::TokenListener to use StatusOr (#945) * Change CredentialsProvider::TokenListener to use StatusOr Rather than a token plus error code/msg. * Eliminate the concept of an invalid Token Instead, we'll just use StatusOr. Note that unauthenticated tokens are handled as a special case; they're created via: Token::Unauthenticated() and are otherwise "valid", though attempting to retrieve the raw token on one of these tokens will cause an assertion failure. --- Firestore/core/src/firebase/firestore/auth/token.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Firestore/core/src/firebase/firestore/auth/token.cc') diff --git a/Firestore/core/src/firebase/firestore/auth/token.cc b/Firestore/core/src/firebase/firestore/auth/token.cc index 4ee1b69..6fe5fc4 100644 --- a/Firestore/core/src/firebase/firestore/auth/token.cc +++ b/Firestore/core/src/firebase/firestore/auth/token.cc @@ -21,15 +21,13 @@ namespace firestore { namespace auth { Token::Token(const absl::string_view token, const User& user) - : token_(token), user_(user), is_valid_(true) { + : token_(token), user_(user) { } -Token::Token() : token_(), user_(User::Unauthenticated()), is_valid_(false) { -} - -const Token& Token::Invalid() { - static const Token kInvalidToken; - return kInvalidToken; +const Token& Token::Unauthenticated() { + static const Token kUnauthenticatedToken(absl::string_view(), + User::Unauthenticated()); + return kUnauthenticatedToken; } } // namespace auth -- cgit v1.2.3