25 lines
665 B
Rust
25 lines
665 B
Rust
use url::Url;
|
|
|
|
use super::Forgejo;
|
|
use crate::forge::auth::application::port::out::forge::{
|
|
errors::OutForgePortResult, get_redirect_uri::GetRedirectUri,
|
|
};
|
|
|
|
impl GetRedirectUri for Forgejo {
|
|
fn get_redirect_uri(
|
|
&self,
|
|
state: &str,
|
|
process_authorization_response_uri: &Url,
|
|
) -> OutForgePortResult<Url> {
|
|
let mut u = self.url().to_owned();
|
|
u.set_path("/login/oauth/authorize");
|
|
u.set_query(Some(&format!(
|
|
"client_id={}&redirect_uri={}&response_type=code&state={state}",
|
|
self.client_id(),
|
|
process_authorization_response_uri.as_str()
|
|
)));
|
|
|
|
Ok(u)
|
|
}
|
|
}
|