Skip to content

Commit

Permalink
Merge branch 'RESTAPI-1295-change-logs-jwt' into 'master'
Browse files Browse the repository at this point in the history
Change JWT logging

See merge request firecrest/firecrest!323
  • Loading branch information
Juan Pablo Dorsch committed Oct 17, 2024
2 parents 75c1f06 + 102633e commit fc42ecc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion deploy/demo/common/common.env
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ F7T_SYSTEMS_PUBLIC_NAME='cluster;cluster'
# {'name':'SCRATCH', 'path':'/home', 'description':'Home filesystem'}] }"
F7T_FILESYSTEMS="{
'cluster': [{'name':'HOME', 'path':'/home', 'description':'Users home filesystem'} ,
{'name':'SCRATCH', 'path':'/scratch', 'description':'Scratch filesystem'}]
{'name':'SCRATCH', 'path':'/scratch', 'description':'Scratch filesystem'},
{'name':'PROJECT', 'path':'/project', 'description':'Projects filesystem'}, ]
} "
#internal machines that microservices connect to (in correlation with SYSTEMS_PUBLIC)
F7T_SYSTEMS_INTERNAL_ADDR='192.168.220.12:22;192.168.220.12:22'
Expand Down
3 changes: 2 additions & 1 deletion deploy/k8s/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ F7T_CERTIFICATOR_HOST: svc-certificator
F7T_COMPUTE_HOST: svc-compute
F7T_FILESYSTEMS: "{
'cluster': [{'name':'HOME', 'path':'/home', 'description':'Users home filesystem'} ,
{'name':'SCRATCH', 'path':'/scratch', 'description':'Scratch filesystem'}]
{'name':'SCRATCH', 'path':'/scratch', 'description':'Scratch filesystem'},
{'name':'PROJECT', 'path':'/project', 'description':'Projects filesystem'}, ]
} "
F7T_GUNICORN_SSL: --ciphers TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,TLS_AES_128_GCM_SHA256,DHE-RSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-RSA-AES128-GCM-SHA256 --ssl-version TLSv1_2 --keyfile /f7t-ssl.key --certfile /f7t-ssl.crt
F7T_JAEGER_AGENT: svc-jaeger
Expand Down
8 changes: 5 additions & 3 deletions src/common/cscs_api_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def check_header(header):

except jwt.exceptions.InvalidSignatureError:
decoding_reason = "JWT token has invalid signature"
logging.error(decoding_reason, exc_info=False)
if DEBUG_MODE:
logging.debug(decoding_reason, exc_info=False)
# try next key
continue
except jwt.exceptions.ExpiredSignatureError:
Expand Down Expand Up @@ -245,15 +246,16 @@ def get_username(header):
algorithms=[auth_pubkey["alg"]],
audience=AUTH_AUDIENCE)
if DEBUG_MODE:
logging.info("Correctly decoded")
logging.debug("Correctly decoded")

# if token is correctly decoded, exit the loop
decoding_result = True
decoding_reason = ""

except jwt.exceptions.InvalidSignatureError:
decoding_reason = "JWT token has invalid signature"
logging.error(decoding_reason, exc_info=False)
if DEBUG_MODE:
logging.debug(decoding_reason, exc_info=False)
# try next key
continue
except jwt.exceptions.ExpiredSignatureError:
Expand Down
2 changes: 1 addition & 1 deletion src/tests/automated_tests/unit/test_unit_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_status_system(system, headers):
for system in SYSTEMS:
STATUS_CODES_SYSTEMS.append((system,200))
STATUS_CODES_FS.append((system,"HOME",200))
STATUS_CODES_FS.append((system,"SCRATCH",400))
STATUS_CODES_FS.append((system,"PROJECT",400))

STATUS_CODES_SYSTEMS.append(("not-a-system",404))

Expand Down

0 comments on commit fc42ecc

Please sign in to comment.