-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor code, add login for getting token
- Loading branch information
Showing
9 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ Cargo.lock | |
*.pdb | ||
.idea | ||
.env | ||
*.pem | ||
|
||
|
||
# Added by cargo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pub const REGISTRATION_URL: &str = "/dbconnections/signup"; | ||
pub const LOGIN_URL: &str = "/oauth/token"; | ||
pub const REGISTRATION_URL: &str = "dbconnections/signup"; | ||
pub const LOGIN_URL: &str = "oauth/token"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
pub mod auth0; | ||
pub mod consts; | ||
mod models; | ||
pub mod requests; | ||
pub mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Debug)] | ||
pub struct Claims { | ||
pub sub: String, | ||
pub email: String, | ||
pub username: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::errors::Result; | ||
use alcoholic_jwt::JWKS; | ||
use std::fs::File; | ||
use std::io::Read; | ||
|
||
pub fn load_pem_cert(file_path: &str) -> Result<Vec<u8>> { | ||
let mut file = File::open(file_path)?; | ||
let mut pem_cert = Vec::new(); | ||
file.read_to_end(&mut pem_cert)?; | ||
Ok(pem_cert) | ||
} | ||
|
||
pub async fn fetch_jwks(uri: &str) -> Result<JWKS> { | ||
let res = reqwest::get(uri).await?; | ||
let val = res.json::<JWKS>().await?; | ||
Ok(val) | ||
} |