Commit 8da0317c authored by Nico Vermaas's avatar Nico Vermaas

enable basic authentication (user/password) also, for test purposes only

parent ad8064be
Pipeline #13339 passed with stages
in 18 minutes and 52 seconds
......@@ -72,15 +72,25 @@ class EsapUserProfileViewSet(viewsets.ModelViewSet):
decoded_payload = base64.urlsafe_b64decode(token[1])
decoded_token = json.loads(decoded_payload.decode("UTF-8"))
sub = decoded_token["sub"]
uid = decoded_token["iss"] + decoded_token["sub"]
name = decoded_token["name"]
user = auth.get_user(self.request)
user_email = user.email
except:
id_token = None
sub = decoded_token["sub"]
uid = decoded_token["iss"] + decoded_token["sub"]
name = decoded_token["name"]
user = auth.get_user(self.request)
user_email = user.email
# no AAI token found, try basic authentication (dev only)
try:
user = self.request.user
user_email = user.email
except:
# if that doesn't work either, and this is 'development'
# then force feed my e-mail to be able to test downstream functionality
# TODO: remove this when shopping basket is working properly
if settings.IS_DEV:
user_email = "vermaas@astron.nl"
return EsapUserProfile.objects.filter(user_email=user_email)
......
version: '3.4'
networks:
esap_network:
traefik_proxy:
external:
name: traefik_proxy
default:
driver: bridge
services:
esap_api_query:
container_name: esap_api_master
image: esap_api_master:latest
ports:
- 15671:8000
expose:
- 8000
networks:
- esap_network
env_file:
- $HOME/shared/oidc.env
restart: always
volumes:
- $HOME/shared/esap-gateway-master/:/shared
version: '3.4'
networks:
esap_network:
traefik_proxy:
external:
name: traefik_proxy
default:
driver: bridge
services:
esap_api:
container_name: esap_api_release
image: esap_api_release:latest
networks:
- esap_network
expose:
- 8000
env_file:
- $HOME/shared/oidc.env
restart: always
volumes:
- $HOME/shared/esap-gateway-release/:/shared
esap_nginx:
build:
context: $HOME/shared
dockerfile: Dockerfile
container_name: esap_nginx
image: esap_nginx:latest
networks:
- esap_network
ports:
- 80:80
volumes:
- $HOME/shared:/shared
- $HOME/shared:/etc/nginx/conf.d
- $HOME/shared/static:/static
restart: always
version: '3.4'
networks:
esap_network:
traefik_proxy:
external:
name: traefik_proxy
default:
driver: bridge
services:
esap_api:
container_name: esap_api
image: esap_api:latest
networks:
- esap_network
expose:
- 8000
env_file:
- $HOME/shared/oidc.env
restart: always
volumes:
- $HOME/shared:/shared
esap_nginx:
build:
context: $HOME/shared
dockerfile: Dockerfile
container_name: esap_nginx
image: esap_nginx:latest
networks:
- esap_network
ports:
- 80:80
volumes:
- $HOME/shared:/shared
- $HOME/shared:/etc/nginx/conf.d
- $HOME/shared/static:/static
restart: always
......@@ -97,6 +97,7 @@ REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'knox.auth.TokenAuthentication',
'mozilla_django_oidc.contrib.drf.OIDCAuthentication',
'rest_framework.authentication.BasicAuthentication',
],
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
......
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