OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_ |
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
(...skipping 28 matching lines...) Expand all Loading... | |
39 | 39 |
40 static AuthResult CreateWithParseError(const std::string& error_message, | 40 static AuthResult CreateWithParseError(const std::string& error_message, |
41 ErrorType error_type); | 41 ErrorType error_type); |
42 static AuthResult CreateWithNSSError(const std::string& error_message, | 42 static AuthResult CreateWithNSSError(const std::string& error_message, |
43 ErrorType error_type, | 43 ErrorType error_type, |
44 int nss_error_code); | 44 int nss_error_code); |
45 | 45 |
46 bool success() const { return error_type == ERROR_NONE; } | 46 bool success() const { return error_type == ERROR_NONE; } |
47 | 47 |
48 std::string error_message; | 48 std::string error_message; |
49 std::string client_auth_certificate; | |
mark a. foltz
2015/01/12 22:01:56
A better API would test the client_auth_certificat
vadimgo
2015/01/13 00:08:27
Store the policy in AuthResult as suggested.
| |
49 ErrorType error_type; | 50 ErrorType error_type; |
50 int nss_error_code; | 51 int nss_error_code; |
51 | 52 |
52 private: | 53 private: |
53 AuthResult(const std::string& error_message, | 54 AuthResult(const std::string& error_message, |
54 ErrorType error_type, | 55 ErrorType error_type, |
55 int nss_error_code); | 56 int nss_error_code); |
56 }; | 57 }; |
57 | 58 |
58 // Authenticates the given |challenge_reply|: | 59 // Authenticates the given |challenge_reply|: |
59 // 1. Signature contained in the reply is valid. | 60 // 1. Signature contained in the reply is valid. |
60 // 2. Certficate used to sign is rooted to a trusted CA. | 61 // 2. Certficate used to sign is rooted to a trusted CA. |
61 AuthResult AuthenticateChallengeReply(const CastMessage& challenge_reply, | 62 AuthResult AuthenticateChallengeReply(const CastMessage& challenge_reply, |
62 const std::string& peer_cert); | 63 const std::string& peer_cert); |
63 | 64 |
64 // Auth-library specific implementation of cryptographic signature | 65 // Auth-library specific implementation of cryptographic signature |
65 // verification routines. Verifies that |response| contains a | 66 // verification routines. Verifies that |response| contains a |
66 // valid signed form of |peer_cert|. | 67 // valid signed form of |peer_cert|. |
67 AuthResult VerifyCredentials(const AuthResponse& response, | 68 AuthResult VerifyCredentials(const AuthResponse& response, |
68 const std::string& peer_cert); | 69 const std::string& peer_cert); |
69 | 70 |
70 } // namespace cast_channel | 71 } // namespace cast_channel |
71 } // namespace core_api | 72 } // namespace core_api |
72 } // namespace extensions | 73 } // namespace extensions |
73 | 74 |
74 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_ | 75 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_ |
OLD | NEW |