From 54bd0eea9e3538fbf8440928b90748d95dd95166 Mon Sep 17 00:00:00 2001
From: Nico Athanassiadis <nico@dsv.su.se>
Date: Tue, 11 Feb 2025 14:15:45 +0100
Subject: [PATCH] Make reviewer pages testable on test servers.

Added scopes and "correct" client redirect uri.
---
 compose-branch-deploy.yaml                           | 4 +++-
 war/src/main/resources/application-branch.properties | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/compose-branch-deploy.yaml b/compose-branch-deploy.yaml
index a71d47138f..21c2d09c33 100644
--- a/compose-branch-deploy.yaml
+++ b/compose-branch-deploy.yaml
@@ -21,7 +21,8 @@ services:
       - OAUTH2_RESOURCE_SERVER_ID=scipro_api_client
       - OAUTH2_RESOURCE_SERVER_SECRET=scipro_api_secret
       - OAUTH2_RESOURCE_SERVER_INTROSPECTION_URI=https://oauth2-${VHOST}/introspect
-      - OAUTH2_GS_AUTHORIZATION_URI=https://oauth2-gs-${VHOST}/authorize
+      - OAUTH2_GS_AUTHORIZATION_URI=https://oauth2-gs-${VHOST}
+      - OAUTH2_GS_CLIENT_REDIRECT_URI=https://${VHOST}/oauth/callback
     networks:
       - traefik
       - internal
@@ -76,6 +77,7 @@ services:
         - CLIENT_REDIRECT_URI=https://${VHOST}/oauth/callback
         - RESOURCE_SERVER_ID=scipro_api_client
         - RESOURCE_SERVER_SECRET=scipro_api_secret
+        - CLIENT_SCOPES="grade:read grade:write"
       networks:
         - traefik
       labels:
diff --git a/war/src/main/resources/application-branch.properties b/war/src/main/resources/application-branch.properties
index 7c6d34aa24..47d660c18a 100644
--- a/war/src/main/resources/application-branch.properties
+++ b/war/src/main/resources/application-branch.properties
@@ -10,7 +10,7 @@ service.grading.url=
 oauth.uri=${OAUTH2_GS_AUTHORIZATION_URI:http://localhost:59734/authorize}
 oauth.clientId=${OAUTH2_CLIENT_ID:scipro}
 oauth.clientSecret=${OAUTH2_CLIENT_SECRET:s3cr3t}
-oauth.redirectUri={baseUrl}/oauth/callback
+oauth.redirectUri=${OAUTH2_GS_CLIENT_REDIRECT_URI}
 
 # No secrets available for branch deployment to branch.dsv.su.se
 # Will have to set up some mock API for this later