Gets the `auth_header` for a request to the server depending on how you want to identify yourself. If you specify `anon_identity = true` then no `auth_header` is returned. If you specify an identity this function will try to find the identity in the config file. If no identity can be found, the program will `exit(1)`. If you do not specify an identity this function will either get the default ide
(
config: &mut Config,
anon_identity: bool,
target_server: Option<&str>,
interactive: bool,
)
| 172 | /// * `anon_identity` - Whether or not to just use an anonymous identity (no identity) |
| 173 | /// * `identity_or_name` - The identity to try to lookup, which is typically provided from the command line |
| 174 | pub async fn get_auth_header( |
| 175 | config: &mut Config, |
| 176 | anon_identity: bool, |
| 177 | target_server: Option<&str>, |
| 178 | interactive: bool, |
| 179 | ) -> anyhow::Result<AuthHeader> { |
| 180 | let token = if anon_identity { |
| 181 | None |
| 182 | } else { |
| 183 | Some(get_login_token_or_log_in(config, target_server, interactive).await?) |
| 184 | }; |
| 185 | Ok(AuthHeader { token }) |
| 186 | } |
| 187 | |
| 188 | #[derive(Debug, Clone)] |
| 189 | pub struct AuthHeader { |
no test coverage detected
searching dependent graphs…