Commit 72f8b967 authored by manuel's avatar manuel

changes in token_service.py

parent 73c9bb09
from security import security_util
import logging
def verifyTokenRegular(token, required_scopes):
return security_util.decodeToken(token)
print("gonna verify token: "+token)
LOGGER = logging.getLogger(__name__)
try:
token_info = security_util.decodeToken(token)
print("TOKEN INFO: "+str(token_info))
LOGGER.info("TOKEN INFO: "+str(token_info))
return token_info
except Exception as e:
print("ERROR DURING TOKEN VALIDATION: "+str(e))
LOGGER.error("ERROR DURING TOKEN VALIDATION: "+str(e))
return None
def verifyTokenAdmin(token, required_scopes):
# TODO call restGateway to verify the token
......
......@@ -18,9 +18,9 @@ SEMANTIC_LINKING_DB_PORT = 27017
## Role Stage Discovery
ROLESTAGE_DISCOVERY_HOSTNAME = 'role-stage-discovery'
ROLESTAGE_DISCOVERY_REST_PORT = 80
ROLESTAGE_DISCOVERY_DB_HOSTNAME = f'{ROLESTAGE_DISCOVERY_HOSTNAME}-db'
ROLESTAGE_DISCOVERY_DB_PORT = 27017
ROLESTAGE_DISCOVERY_REST_PORT = 30103
ROLESTAGE_DISCOVERY_DB_HOSTNAME = f'articonf1.itec.aau.at'
ROLESTAGE_DISCOVERY_DB_PORT = 30104
## Rest Gateway
# REST_GATEWAY_HOSTNAME = 'rest-gateway'
......
......@@ -51,8 +51,12 @@ def decodeToken(token: str) -> Dict:
raise ValueError('Invalid JWT token (must be a Bearer string)')
token = token[7:]
response = requests.get(
f'https://{REST_GATEWAY_HOSTNAME}/api/tokens/{token}')
response = requests.post(
f'https://{network_constants.REST_GATEWAY_HOSTNAME}:{network_constants.REST_GATEWAY_REST_PORT}/api/tokens/{token}',
verify=False,
headers={'User-Agent': 'Chrome', 'Accept': 'application/json', 'Content-Type': 'application/json'},
proxies = { "http":"http://proxy.uni-klu.ac.at:3128/", "https":"http://proxy.uni-klu.ac.at:3128/" }
)
if response.status_code != 200:
raise ValueError(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment