Perform the parsing and populate JWKS's internal map. Return error status if encountering any error.
| 70 | // Perform the parsing and populate JWKS's internal map. Return error status if |
| 71 | // encountering any error. |
| 72 | Status Parse(const Document& rules_doc) { |
| 73 | bool found_keys = false; |
| 74 | for (Value::ConstMemberIterator member = rules_doc.MemberBegin(); |
| 75 | member != rules_doc.MemberEnd(); ++member) { |
| 76 | if (strcmp("keys", member->name.GetString()) == 0) { |
| 77 | found_keys = true; |
| 78 | RETURN_IF_ERROR(ParseKeys(member->value)); |
| 79 | } else { |
| 80 | return Status(TErrorCode::JWKS_PARSE_ERROR, |
| 81 | Substitute( |
| 82 | "Unexpected property '$0' must be removed", member->name.GetString())); |
| 83 | } |
| 84 | } |
| 85 | if (!found_keys) { |
| 86 | return Status(TErrorCode::JWKS_PARSE_ERROR, "An array of keys is required"); |
| 87 | } |
| 88 | return Status::OK(); |
| 89 | } |
| 90 | |
| 91 | private: |
| 92 | JWKSSnapshot* jwks_; |
no test coverage detected