mirror of
https://git.proxmox.com/git/proxmox-perl-rs
synced 2025-05-23 20:11:03 +00:00
cargo fmt
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
03bba92a8b
commit
95e5e59fd0
@ -104,7 +104,10 @@ pub mod export {
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(file) = files.iter_mut().find(|file| file.path.as_ref() == Some(&path)) {
|
||||
if let Some(file) = files
|
||||
.iter_mut()
|
||||
.find(|file| file.path.as_ref() == Some(&path))
|
||||
{
|
||||
file.repositories.push(repo);
|
||||
|
||||
file.write()?;
|
||||
@ -145,7 +148,10 @@ pub mod export {
|
||||
bail!("unable to parse file {} - {}", error.path, error.error);
|
||||
}
|
||||
|
||||
if let Some(file) = files.iter_mut().find(|file| file.path.as_ref() == Some(&path.to_string())) {
|
||||
if let Some(file) = files
|
||||
.iter_mut()
|
||||
.find(|file| file.path.as_ref() == Some(&path.to_string()))
|
||||
{
|
||||
if let Some(repo) = file.repositories.get_mut(index) {
|
||||
if let Some(enabled) = options.enabled {
|
||||
repo.set_enabled(enabled);
|
||||
|
@ -1,13 +1,13 @@
|
||||
#[perlmod::package(name = "PVE::RS::OpenId", lib = "pve_rs")]
|
||||
mod export {
|
||||
use std::sync::Mutex;
|
||||
use std::convert::TryFrom;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use anyhow::Error;
|
||||
|
||||
use perlmod::{to_value, Value};
|
||||
|
||||
use proxmox_openid::{OpenIdConfig, OpenIdAuthenticator, PrivateAuthState};
|
||||
use proxmox_openid::{OpenIdAuthenticator, OpenIdConfig, PrivateAuthState};
|
||||
|
||||
const CLASSNAME: &str = "PVE::RS::OpenId";
|
||||
|
||||
@ -44,7 +44,6 @@ mod export {
|
||||
config: OpenIdConfig,
|
||||
redirect_url: &str,
|
||||
) -> Result<Value, Error> {
|
||||
|
||||
let open_id = OpenIdAuthenticator::discover(&config, redirect_url)?;
|
||||
bless(
|
||||
class,
|
||||
@ -60,7 +59,6 @@ mod export {
|
||||
state_dir: &str,
|
||||
realm: &str,
|
||||
) -> Result<String, Error> {
|
||||
|
||||
let open_id = this.inner.lock().unwrap();
|
||||
open_id.authorize_url(state_dir, realm)
|
||||
}
|
||||
@ -69,17 +67,16 @@ mod export {
|
||||
pub fn verify_public_auth_state(
|
||||
state_dir: &str,
|
||||
state: &str,
|
||||
) -> Result<(String, PrivateAuthState), Error> {
|
||||
) -> Result<(String, PrivateAuthState), Error> {
|
||||
OpenIdAuthenticator::verify_public_auth_state(state_dir, state)
|
||||
}
|
||||
|
||||
#[export(raw_return)]
|
||||
pub fn verify_authorization_code(
|
||||
#[try_from_ref] this: &OpenId,
|
||||
#[try_from_ref] this: &OpenId,
|
||||
code: &str,
|
||||
private_auth_state: PrivateAuthState,
|
||||
) -> Result<Value, Error> {
|
||||
|
||||
let open_id = this.inner.lock().unwrap();
|
||||
let claims = open_id.verify_authorization_code_simple(code, &private_auth_state)?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user