MCPcopy Create free account
hub / github.com/Firstyear/opensuse-proxy-cache / configure_oauth

Function configure_oauth

opensuse-proxy-cache/src/auth.rs:48–65  ·  view source on GitHub ↗
(
    client_id: &str,
    client_secret: &str,
    client_url: &str,
    server_url: &str,
)

Source from the content-addressed store, hash-verified

46}
47
48pub fn configure_oauth(
49 client_id: &str,
50 client_secret: &str,
51 client_url: &str,
52 server_url: &str,
53) -> BasicClient {
54 let client_id = ClientId::new(client_id.to_string());
55 let secret = ClientSecret::new(client_secret.to_string());
56 let auth_url = AuthUrl::new(format!("{}/ui/oauth2", server_url)).unwrap();
57 let token_url = TokenUrl::new(format!("{}/oauth2/token", server_url)).unwrap();
58 let intro_url =
59 IntrospectionUrl::new(format!("{}/oauth2/token/introspect", server_url)).unwrap();
60 let redir_url = RedirectUrl::new(format!("{}/oauth/response", client_url)).unwrap();
61
62 BasicClient::new(client_id, Some(secret), auth_url, Some(token_url))
63 .set_redirect_uri(redir_url)
64 .set_introspection_uri(intro_url)
65}
66
67// Not authenticated - kick of the redir to oauth.
68pub(crate) async fn login_view(mut request: tide::Request<Arc<AppState>>) -> tide::Result {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected