Parses and validates FLAGS_saml2_sp_callback_url. Sets saml_sp_path to the path part if successful.
| 1079 | // Parses and validates FLAGS_saml2_sp_callback_url. |
| 1080 | // Sets saml_sp_path to the path part if successful. |
| 1081 | Status ParseSamlSpUrl(string* saml_sp_path) { |
| 1082 | vector<string> split = |
| 1083 | Split(FLAGS_saml2_sp_callback_url, delimiter::Limit("/", 3)); |
| 1084 | if (split.size() != 4 || (split[0] != "http:" && split[0] != "https:")) { |
| 1085 | return Status( |
| 1086 | Substitute("Bad saml2_sp_callback_url: $0", FLAGS_saml2_sp_callback_url)); |
| 1087 | } |
| 1088 | // The port in the url should be the same as FLAGS_hs2_http_port in general, |
| 1089 | // but this is not enforced to allow the use case when the port is mapped, |
| 1090 | // e.g. external_port->http_port. FLAGS_saml2_sp_callback_url has to contain the |
| 1091 | // external_port in this case. |
| 1092 | if (saml_sp_path != nullptr) *saml_sp_path = "/" + split[3]; |
| 1093 | return Status::OK(); |
| 1094 | } |
| 1095 | |
| 1096 | namespace { |
| 1097 |