Retrieve access token from provider

This commit is contained in:
2023-04-26 12:22:06 +02:00
parent 38e7c96d20
commit bee794a589
6 changed files with 107 additions and 23 deletions

View File

@@ -2,7 +2,9 @@ use std::path::{Path, PathBuf};
use clap::Parser;
use crate::constants::{APP_NAME, CLIENTS_LIST_FILE, PROVIDERS_LIST_FILE, USERS_LIST_FILE};
use crate::constants::{
APP_NAME, CLIENTS_LIST_FILE, OIDC_PROVIDER_CB_URI, PROVIDERS_LIST_FILE, USERS_LIST_FILE,
};
/// Basic OIDC provider
#[derive(Parser, Debug, Clone)]
@@ -84,6 +86,12 @@ impl AppConfig {
}
}
/// Get the URL where a upstream OpenID provider should redirect
/// the user after an authentication
pub fn oidc_provider_redirect_url(&self) -> String {
AppConfig::get().full_url(OIDC_PROVIDER_CB_URI)
}
pub fn domain_name(&self) -> &str {
self.website_origin.split('/').nth(2).unwrap_or(APP_NAME)
}