openid: move helper from config to api2

it's not really needed in the config module, and this makes it easier to
disable the proxmox-openid dependency linkage as a stop-gap measure.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-07-01 14:58:32 +02:00
committed by Thomas Lamprecht
parent 324c069848
commit 26a3450f19
2 changed files with 14 additions and 17 deletions

View File

@ -3,8 +3,6 @@ use lazy_static::lazy_static;
use std::collections::HashMap;
use serde::{Serialize, Deserialize};
use proxmox_openid::{OpenIdAuthenticator, OpenIdConfig};
use proxmox::api::{
api,
schema::*,
@ -95,18 +93,6 @@ pub struct OpenIdRealmConfig {
pub username_claim: Option<OpenIdUserAttribute>,
}
impl OpenIdRealmConfig {
pub fn authenticator(&self, redirect_url: &str) -> Result<OpenIdAuthenticator, Error> {
let config = OpenIdConfig {
issuer_url: self.issuer_url.clone(),
client_id: self.client_id.clone(),
client_key: self.client_key.clone(),
};
OpenIdAuthenticator::discover(&config, redirect_url)
}
}
fn init() -> SectionConfig {
let obj_schema = match OpenIdRealmConfig::API_SCHEMA {
Schema::Object(ref obj_schema) => obj_schema,