From f5963c35533f3d4ba035666fa8fe5682d0f83eb9 Mon Sep 17 00:00:00 2001 From: Fenris Wolf Date: Mon, 6 Oct 2025 21:42:50 +0200 Subject: [PATCH] [sty] --- source/auth.ts | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/source/auth.ts b/source/auth.ts index 8c1c062..ee40336 100644 --- a/source/auth.ts +++ b/source/auth.ts @@ -52,10 +52,12 @@ namespace _zeitbild.auth key : string ) : string { - if (_oidc_redict_uri_template_map === null) { + if (_oidc_redict_uri_template_map === null) + { throw (new Error("apparently not initialized yet")); } - else { + else + { return _oidc_redict_uri_template_map.get(key); } } @@ -67,7 +69,8 @@ namespace _zeitbild.auth ) : Promise { switch (_zeitbild.conf.get().authentication.kind) { - case "internal": { + case "internal": + { _subject = lib_plankton.auth.internal.implementation_auth( { "password_image_chest": { @@ -83,7 +86,8 @@ namespace _zeitbild.auth ); break; } - case "oidc": { + case "oidc": + { _subject_oidc = lib_plankton.auth.oidc.make( { "url_authorization": _zeitbild.conf.get().authentication.data.url_authorization, @@ -108,7 +112,8 @@ namespace _zeitbild.auth return Promise.resolve(undefined); break; } - default: { + default: + { // do nothing break; } @@ -123,12 +128,16 @@ namespace _zeitbild.auth input : any ) : Promise<{kind : string; data : any;}> { - switch (_zeitbild.conf.get().authentication.kind) { - case "oidc": { - if ((_subject_oidc === null) || (_oidc_redict_uri_template_map === null)) { + switch (_zeitbild.conf.get().authentication.kind) + { + case "oidc": + { + if ((_subject_oidc === null) || (_oidc_redict_uri_template_map === null)) + { throw (new Error("not initialized yet")); } - else { + else + { const stuff : {state : string; authorization_url : string;} = lib_plankton.auth.oidc.prepare_login(_subject_oidc); _oidc_redict_uri_template_map.set( stuff.state, @@ -146,11 +155,14 @@ namespace _zeitbild.auth } break; } - default: { - if (_subject === null) { + default: + { + if (_subject === null) + { return Promise.reject(new Error("not initialized yet")); } - else { + else + { return ( _subject.login_prepare() .then( @@ -183,10 +195,12 @@ namespace _zeitbild.auth } > { - if ((_subject_oidc === null) || (_oidc_redict_uri_template_map === null)) { + if ((_subject_oidc === null) || (_oidc_redict_uri_template_map === null)) + { throw (new Error("not initialized yet")); } - else { + else + { const state : string = data["state"]; const result : { token : string;