-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Possibility for no authentication (#464)
* add a no-auth user * tests running with right config * Apply suggestions from code review Co-authored-by: Carmen Tawalika <[email protected]>
- Loading branch information
1 parent
5ea0553
commit 5c83d83
Showing
15 changed files
with
535 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[GRASS] | ||
grass_database = /actinia_core/grassdb | ||
grass_user_database = /actinia_core/userdata | ||
grass_tmp_database = /actinia_core/workspace/temp_db | ||
grass_resource_dir = /actinia_core/resources | ||
|
||
[API] | ||
force_https_urls = True | ||
authentication = False | ||
|
||
[LIMITS] | ||
max_cell_limit = 22500000 | ||
process_time_limt = 60 | ||
process_num_limit = 20 | ||
|
||
[REDIS] | ||
worker_logfile = /actinia_core/workspace/tmp/actinia_worker_test.log | ||
redis_server_url = localhost | ||
redis_server_port = 6379 | ||
|
||
[LOGGING] | ||
log_level = 1 | ||
|
||
[MISC] | ||
tmp_workdir = /actinia_core/workspace/tmp | ||
download_cache = /actinia_core/workspace/download_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,25 @@ | ||
[GRASS] | ||
grass_gis_start_script = /usr/local/bin/grass | ||
grass_database = /actinia_core/grassdb | ||
grass_user_database = /actinia_core/userdata | ||
grass_tmp_database = /actinia_core/workspace/temp_db | ||
grass_resource_dir = /actinia_core/resources | ||
grass_addon_path = /root/.grass8/addons/ | ||
grass_gis_base = /usr/local/grass | ||
grass_modules_xml_path = /usr/local/grass/gui/wxpython/xml/module_items.xml | ||
grass_default_location = nc_spm_08 | ||
|
||
[API] | ||
plugins = [] | ||
force_https_urls = True | ||
|
||
[LIMITS] | ||
max_cell_limit = 22500000 | ||
process_time_limt = 60 | ||
process_num_limit = 20 | ||
number_of_workers = 3 | ||
|
||
[REDIS] | ||
worker_logfile = /actinia_core/workspace/tmp/actinia_worker_test.log | ||
redis_server_url = localhost | ||
redis_server_port = 6379 | ||
redis_queue_server_url = localhost | ||
redis_queue_server_port = 6379 | ||
worker_queue_name = actinia_job | ||
worker_logfile = /actinia_core/workspace/tmp/actinia_worker_test.log | ||
|
||
[LOGGING] | ||
log_interface = fluentd | ||
log_fluent_host = fluentd | ||
log_fluent_port = 24224 | ||
log_level = 1 | ||
|
||
[MISC] | ||
tmp_workdir = /actinia_core/workspace/tmp | ||
download_cache = /actinia_core/workspace/download_cache | ||
secret_key = token_signing_key_changeme | ||
|
||
[MANAGEMENT] | ||
default_user = user | ||
default_user_group = group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# -*- coding: utf-8 -*- | ||
####### | ||
# actinia-core - an open source REST API for scalable, distributed, high | ||
# performance processing of geographical data that uses GRASS GIS for | ||
# computational tasks. For details, see https://actinia.mundialis.de/ | ||
# | ||
# Copyright (c) 2023 mundialis GmbH & Co. KG | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
####### | ||
|
||
""" | ||
User management for no authentication | ||
""" | ||
|
||
# from passlib.apps import custom_app_context as pwd_context | ||
# import jwt | ||
# from datetime import datetime, timezone, timedelta | ||
from actinia_core.core.common.config import global_config | ||
from actinia_core.core.redis_user import redis_user_interface | ||
from actinia_core.core.common.user import ActiniaUser | ||
|
||
|
||
__author__ = "Anika Weinmann" | ||
__copyright__ = "Copyright 2023, mundialis GmbH & Co. KG" | ||
__maintainer__ = "mundialis GmbH & Co. KG" | ||
|
||
|
||
class ActiniaUserNoAuth(ActiniaUser): | ||
""" | ||
The Actinia Core user management class for no authentication | ||
""" | ||
|
||
db = redis_user_interface | ||
|
||
def __init__(self): | ||
"""Constructor | ||
Initialize and create a user object for no authentication. | ||
""" | ||
self.user_id = global_config.DEFAULT_USER | ||
self.user_group = global_config.DEFAULT_USER_GROUP | ||
self.password_hash = None | ||
self.user_role = "superadmin" | ||
self.permissions = None | ||
self.cell_limit = global_config.MAX_CELL_LIMIT | ||
self.accessible_datasets = { | ||
"nc_spm_08": ["PERMANENT", "user1", "landsat"], | ||
"ECAD": ["PERMANENT"], | ||
"latlong_wgs84": ["PERMANENT"], | ||
} | ||
self.accessible_modules = global_config.MODULE_ALLOW_LIST | ||
self.process_num_limit = global_config.PROCESS_NUM_LIMIT | ||
self.process_time_limit = global_config.PROCESS_TIME_LIMT | ||
|
||
@staticmethod | ||
def create_user(): | ||
"""Create a new user object for no authentication and initialize it | ||
Returns: | ||
actinia_core_api.common.user_noauth.ActiniaUserNoAuth: | ||
A new user object in case of success, or None in case of failure | ||
""" | ||
user = ActiniaUserNoAuth() | ||
user.hash_password("") | ||
|
||
if user.commit() is True: | ||
return user | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.