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 clap::ArgMatches;
|
||||
@ -20,6 +20,7 @@ pub enum AuthenticationType {
|
||||
None,
|
||||
}
|
||||
|
||||
#[derive()]
|
||||
pub struct Request<'a> {
|
||||
pub client: Client,
|
||||
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 {
|
||||
AuthenticationType::BasicAuth => {
|
||||
URL_SAFE.encode(self.authentication.credentials.1.unwrap())
|
||||
}
|
||||
AuthenticationType::ApiToken => self.authentication.credentials.1,
|
||||
AuthenticationType::BasicAuth => URL_SAFE.encode(key),
|
||||
AuthenticationType::ApiToken => key.to_string(),
|
||||
AuthenticationType::None => {
|
||||
// TODO: make a custom error and error here instead of panicing
|
||||
// this shouldn't happen, ever
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn url_builder(&self) {
|
||||
Ok()
|
||||
}
|
||||
pub fn url_builder(&self) -> String {}
|
||||
}
|
||||
|
||||
impl Authentication {
|
||||
|
Loading…
Reference in New Issue
Block a user