Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
add openapi YAML and app database schema init
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-stauffer committed Sep 19, 2023
1 parent 7bc59c9 commit 6d39d06
Show file tree
Hide file tree
Showing 13 changed files with 479 additions and 85 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of the eliona project.
# Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
# Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
# ______ _ _
# | ____| (_)
# | |__ | |_ ___ _ __ __ _
Expand Down
2 changes: 1 addition & 1 deletion apiservices/api_configuration_service.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
2 changes: 1 addition & 1 deletion apiservices/api_customization_service.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
2 changes: 1 addition & 1 deletion apiservices/api_version_service.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
2 changes: 1 addition & 1 deletion app.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
2 changes: 1 addition & 1 deletion conf/conf.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
2 changes: 1 addition & 1 deletion conf/init.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
49 changes: 44 additions & 5 deletions conf/init.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- This file is part of the eliona project.
-- Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
-- Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
-- ______ _ _
-- | ____| (_)
-- | |__ | |_ ___ _ __ __ _
Expand All @@ -13,8 +13,47 @@
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

create schema if not exists template;
CREATE SCHEMA IF NOT EXISTS saml_sp;

--
-- Todo: create tables and database objects necessary for this app like tables persisting configuration
--
GRANT USAGE ON SCHEMA saml_sp TO leicom;
GRANT ALL ON SCHEMA saml_sp TO leicom;

CREATE TABLE IF NOT EXISTS saml_sp.basic_config (
enable BOOLEAN PRIMARY KEY NOT NULL DEFAULT true,
sp_certificate TEXT NOT NULL ,
sp_private_key TEXT NOT NULL ,
idp_metadata_url TEXT ,
metadata_xml TEXT DEFAULT NULL,
own_url TEXT
) ;

CREATE TABLE IF NOT EXISTS saml_sp.attribute_map (
enable BOOLEAN NOT NULL REFERENCES saml_sp.basic_config(enable),
email TEXT PRIMARY KEY NOT NULL DEFAULT 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn',
first_name TEXT DEFAULT NULL,
last_name TEXT DEFAULT NULL,
phone TEXT DEFAULT NULL
) ;

CREATE TABLE IF NOT EXISTS saml_sp.advanced_config (
enable BOOLEAN PRIMARY KEY NOT NULL REFERENCES saml_sp.basic_config(enable),
allow_initialization_by_idp BOOLEAN NOT NULL DEFAULT false,
signed_request BOOLEAN NOT NULL DEFAULT true,
force_authn BOOLEAN NOT NULL DEFAULT false,
entity_id TEXT NOT NULL DEFAULT '{ownUrl}/saml/metadata',
cookie_secure BOOLEAN NOT NULL DEFAULT false,
login_failed_url TEXT NOT NULL DEFAULT '{ownUrl}/noLogin'
) ;

CREATE TABLE IF NOT EXISTS saml_sp.permissions (
enable BOOLEAN PRIMARY KEY NOT NULL REFERENCES saml_sp.basic_config(enable),
default_system_role TEXT NOT NULL DEFAULT 'regular', -- reference to is maybe a bad idea (new ACL)
default_proj_role TEXT NOT NULL DEFAULT 'operator',
system_role_saml_attribute TEXT,
system_role_map JSON,
proj_role_saml_attribute TEXT,
proj_role_map JSON
) ;

-- To INIT
-- INSERT INTO saml_sp.attribute_map (enable, username, username_cut_email_sufix) VALUES (true, 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn', false) ON CONFLICT(username) DO NOTHING;
2 changes: 1 addition & 1 deletion eliona/assets.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
2 changes: 1 addition & 1 deletion eliona/init.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of the eliona project.
// Copyright © 2022 LEICOM iTEC AG. All Rights Reserved.
// Copyright © 2023 LEICOM iTEC AG. All Rights Reserved.
// ______ _ _
// | ____| (_)
// | |__ | |_ ___ _ __ __ _
Expand Down
Loading

0 comments on commit 6d39d06

Please sign in to comment.