Redirect user to authentication
This commit is contained in:
@ -100,33 +100,29 @@ impl AppConfig {
|
||||
}
|
||||
|
||||
/// Get Redis connection configuration
|
||||
pub fn redis_connection_config(&self) -> redis::ConnectionInfo {
|
||||
redis::ConnectionInfo {
|
||||
addr: redis::ConnectionAddr::Tcp(self.redis_hostname.clone(), self.redis_port),
|
||||
redis: redis::RedisConnectionInfo {
|
||||
db: self.redis_db_number,
|
||||
username: self.redis_username.clone(),
|
||||
password: Some(self.redis_password.clone()),
|
||||
protocol: Default::default(),
|
||||
},
|
||||
}
|
||||
pub fn redis_connection_string(&self) -> String {
|
||||
format!(
|
||||
"redis://{}:{}@{}:{}/{}",
|
||||
self.redis_username.as_deref().unwrap_or(""),
|
||||
self.redis_password,
|
||||
self.redis_hostname,
|
||||
self.redis_port,
|
||||
self.redis_db_number
|
||||
)
|
||||
}
|
||||
|
||||
/// Get OpenID providers configuration
|
||||
pub fn openid_providers(&self) -> OIDCProvider<'_> {
|
||||
pub fn openid_provider(&self) -> OIDCProvider<'_> {
|
||||
OIDCProvider {
|
||||
client_id: self.oidc_client_id.as_str(),
|
||||
client_secret: self.oidc_client_secret.as_str(),
|
||||
configuration_url: self.oidc_configuration_url.as_str(),
|
||||
redirect_url: self
|
||||
.oidc_redirect_url
|
||||
.replace("APP_ORIGIN", &self.website_origin),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get OIDC callback URL
|
||||
pub fn oidc_redirect_url(&self) -> String {
|
||||
self.oidc_redirect_url
|
||||
.replace("APP_ORIGIN", &self.website_origin)
|
||||
}
|
||||
|
||||
/// Get s3 bucket credentials
|
||||
pub fn s3_credentials(&self) -> anyhow::Result<Credentials> {
|
||||
Ok(Credentials::new(
|
||||
@ -157,4 +153,5 @@ pub struct OIDCProvider<'a> {
|
||||
pub client_id: &'a str,
|
||||
pub client_secret: &'a str,
|
||||
pub configuration_url: &'a str,
|
||||
pub redirect_url: String,
|
||||
}
|
||||
|
Reference in New Issue
Block a user