mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-16 10:03:14 -07:00
oidc stuff coming across the wire properly and generating a working login URL
This commit is contained in:
parent
eaccce743f
commit
663a09b38d
6 changed files with 26 additions and 15 deletions
|
@ -156,10 +156,14 @@ pub extern "C" fn zeroidc_auth_info_delete(ptr: *mut AuthInfo) {
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_get_auth_url(ptr: *mut AuthInfo) -> *const c_char {
|
||||
if ptr.is_null() {
|
||||
println!("passed a null object");
|
||||
return std::ptr::null_mut();
|
||||
}
|
||||
let ai = unsafe {
|
||||
assert!(!ptr.is_null());
|
||||
&mut *ptr
|
||||
};
|
||||
|
||||
let s = CString::new(ai.url.to_string()).unwrap();
|
||||
return s.as_ptr();
|
||||
return s.into_raw();
|
||||
}
|
||||
|
|
|
@ -71,7 +71,10 @@ impl ZeroIDC {
|
|||
|
||||
let provider_meta = match CoreProviderMetadata::discover(&iss, http_client) {
|
||||
Ok(m) => m,
|
||||
Err(e) => return Err(e.to_string()),
|
||||
Err(e) => {
|
||||
println!("Error discovering provider metadata");
|
||||
return Err(e.to_string());
|
||||
},
|
||||
};
|
||||
|
||||
let r = format!("http://localhost:{}/sso", local_web_port);
|
||||
|
@ -85,7 +88,10 @@ impl ZeroIDC {
|
|||
|
||||
let redirect = match RedirectUrl::new(redir_url.to_string()) {
|
||||
Ok(s) => s,
|
||||
Err(e) => return Err(e.to_string()),
|
||||
Err(e) => {
|
||||
println!("Error generating RedirectURL instance from string: {}", redir_url.to_string());
|
||||
return Err(e.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
(*idc.inner.lock().unwrap()).oidc_client = Some(
|
||||
|
@ -152,13 +158,16 @@ impl ZeroIDC {
|
|||
csrf_func(csrf_token),
|
||||
nonce_func(nonce),
|
||||
)
|
||||
.add_scope(Scope::new("read".to_string()))
|
||||
.add_scope(Scope::new("profile".to_string()))
|
||||
.add_scope(Scope::new("email".to_string()))
|
||||
.add_scope(Scope::new("offline_access".to_string()))
|
||||
.add_scope(Scope::new("openid".to_string()))
|
||||
.set_pkce_challenge(pkce_challenge)
|
||||
.add_extra_param("network_id", network_id)
|
||||
.url();
|
||||
|
||||
println!("URL: {}", auth_url);
|
||||
|
||||
return AuthInfo {
|
||||
url: auth_url,
|
||||
csrf_token,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue