fixed up base64 encoding
This commit is contained in:
parent
aa80bc0cc7
commit
8e85ceebaf
@ -1,4 +1,4 @@
|
|||||||
use std::{collections::HashMap, process};
|
use std::{collections::HashMap, process, string::String};
|
||||||
|
|
||||||
use base64::{engine::general_purpose::URL_SAFE, Engine as _};
|
use base64::{engine::general_purpose::URL_SAFE, Engine as _};
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
@ -20,6 +20,7 @@ pub enum AuthenticationType {
|
|||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive()]
|
||||||
pub struct Request<'a> {
|
pub struct Request<'a> {
|
||||||
pub client: Client,
|
pub client: Client,
|
||||||
pub arg_value: &'a ArgMatches<'a>,
|
pub arg_value: &'a ArgMatches<'a>,
|
||||||
@ -69,22 +70,20 @@ impl<'a> Request<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn auth_type(&self) {
|
pub fn auth_type(&self) -> String {
|
||||||
|
let key: &String = self.authentication.credentials.1.as_ref().unwrap();
|
||||||
match self.authentication.auth_type {
|
match self.authentication.auth_type {
|
||||||
AuthenticationType::BasicAuth => {
|
AuthenticationType::BasicAuth => URL_SAFE.encode(key),
|
||||||
URL_SAFE.encode(self.authentication.credentials.1.unwrap())
|
AuthenticationType::ApiToken => key.to_string(),
|
||||||
}
|
|
||||||
AuthenticationType::ApiToken => self.authentication.credentials.1,
|
|
||||||
AuthenticationType::None => {
|
AuthenticationType::None => {
|
||||||
|
// TODO: make a custom error and error here instead of panicing
|
||||||
// this shouldn't happen, ever
|
// this shouldn't happen, ever
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn url_builder(&self) {
|
pub fn url_builder(&self) -> String {}
|
||||||
Ok()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Authentication {
|
impl Authentication {
|
||||||
|
Loading…
Reference in New Issue
Block a user