Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/20-django-api-token' into 20-dja…
Browse files Browse the repository at this point in the history
…ngo-api-token

# Conflicts:
#	README.md
  • Loading branch information
skoulouzis committed Sep 5, 2023
2 parents c80a726 + 1aee9ef commit e751f67
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ echo -n $ARGO_TOKEN | base64 -w 0
2. Create a token for the user in the Django admin panel
3. Use the token in the header of the request

```python
resp = requests.get(
f"{api_endpoint}/api/workflows/",
headers={
'Authorization': 'Token '+ naavre_api_token
}
)
```
1. Create a user in the Django admin panel
2. Create a token for the user in the Django admin panel
3. Use the token in the header of the request

```python
resp = requests.get(
f"{api_endpoint}/api/workflows/",
Expand Down
2 changes: 1 addition & 1 deletion vre-panel/pages/vlabs/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export async function getServerSideProps(context:any) {
const { req } = context;
const secret = process.env.SECRET;
const token = await getToken({ req, secret });

console.log(token)
return {
props: {
token: token
Expand Down
1 change: 1 addition & 0 deletions vreapis/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ djangorestframework-gis~=1.0.0
django-filter~=22.1.0
whitenoise
django-keycloak-auth
python-keycloak
gunicorn
pyyaml
requests
Expand Down
2 changes: 1 addition & 1 deletion vreapis/vreapis/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]

KEYCLOAK_EXEMPT_URIS = []

#
KEYCLOAK_CONFIG = {
'KEYCLOAK_SERVER_URL': os.getenv('KEYCLOAK_SERVER_URL'),
'KEYCLOAK_REALM': os.getenv('KEYCLOAK_REALM'),
Expand Down
2 changes: 1 addition & 1 deletion vreapis/workflows/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def submit(self, request, *args, **kwargs):
try:
vlab = VirtualLab.objects.get(slug=vlab_slug)
except VirtualLab.DoesNotExist:
return Response({'message': 'Virtual Lab not found'}, status=404)
return Response({'message': 'Virtual Lab: ' + vlab_slug + ' not found'}, status=404)
if not argo_url:
return Response({'message': 'Argo URL not set'}, status=500)
argo_exec_url = f"{argo_url}/workflows/{namespace}/{resp_detail_data['metadata']['name']}"
Expand Down

0 comments on commit e751f67

Please sign in to comment.