| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_BASE_AUTH_H__ | 5 #ifndef NET_BASE_AUTH_H__ |
| 6 #define NET_BASE_AUTH_H__ | 6 #define NET_BASE_AUTH_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Set the |username| and |password|. | 53 // Set the |username| and |password|. |
| 54 void Set(const base::string16& username, const base::string16& password); | 54 void Set(const base::string16& username, const base::string16& password); |
| 55 | 55 |
| 56 // Determines if |this| is equivalent to |other|. | 56 // Determines if |this| is equivalent to |other|. |
| 57 bool Equals(const AuthCredentials& other) const; | 57 bool Equals(const AuthCredentials& other) const; |
| 58 | 58 |
| 59 // Returns true if all credentials are empty. | 59 // Returns true if all credentials are empty. |
| 60 bool Empty() const; | 60 bool Empty() const; |
| 61 | 61 |
| 62 // Overwrites the password memory to prevent it from being read if | |
| 63 // it's paged out to disk. | |
| 64 void Zap(); | |
| 65 | |
| 66 const base::string16& username() const { return username_; } | 62 const base::string16& username() const { return username_; } |
| 67 const base::string16& password() const { return password_; } | 63 const base::string16& password() const { return password_; } |
| 68 | 64 |
| 69 private: | 65 private: |
| 70 // The username to provide, possibly empty. This should be ASCII only to | 66 // The username to provide, possibly empty. This should be ASCII only to |
| 71 // minimize compatibility problems, but arbitrary UTF-16 strings are allowed | 67 // minimize compatibility problems, but arbitrary UTF-16 strings are allowed |
| 72 // and will be attempted. | 68 // and will be attempted. |
| 73 base::string16 username_; | 69 base::string16 username_; |
| 74 | 70 |
| 75 // The password to provide, possibly empty. This should be ASCII only to | 71 // The password to provide, possibly empty. This should be ASCII only to |
| 76 // minimize compatibility problems, but arbitrary UTF-16 strings are allowed | 72 // minimize compatibility problems, but arbitrary UTF-16 strings are allowed |
| 77 // and will be attempted. | 73 // and will be attempted. |
| 78 base::string16 password_; | 74 base::string16 password_; |
| 79 | 75 |
| 80 // Intentionally allowing the implicit copy constructor and assignment | 76 // Intentionally allowing the implicit copy constructor and assignment |
| 81 // operators. | 77 // operators. |
| 82 }; | 78 }; |
| 83 | 79 |
| 84 // Authentication structures | 80 // Authentication structures |
| 85 enum AuthState { | 81 enum AuthState { |
| 86 AUTH_STATE_DONT_NEED_AUTH, | 82 AUTH_STATE_DONT_NEED_AUTH, |
| 87 AUTH_STATE_NEED_AUTH, | 83 AUTH_STATE_NEED_AUTH, |
| 88 AUTH_STATE_HAVE_AUTH, | 84 AUTH_STATE_HAVE_AUTH, |
| 89 AUTH_STATE_CANCELED | 85 AUTH_STATE_CANCELED |
| 90 }; | 86 }; |
| 91 | 87 |
| 92 } // namespace net | 88 } // namespace net |
| 93 | 89 |
| 94 #endif // NET_BASE_AUTH_H__ | 90 #endif // NET_BASE_AUTH_H__ |
| OLD | NEW |