Skip to content

Commit

Permalink
Merge pull request #124 from NIAEFEUP/fix/prod-oidc-callback-invalid-url
Browse files Browse the repository at this point in the history
fix: prod oidc callback invalid url
  • Loading branch information
tomaspalma authored Jan 2, 2025
2 parents 7d8a98d + cb0b3cc commit 47b6911
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 17 deletions.
4 changes: 2 additions & 2 deletions django/tts_be/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@
OIDC_RP_CLIENT_SECRET = os.environ['OIDC_RP_CLIENT_SECRET']
OIDC_RP_SIGN_ALGO = "RS256"

OIDC_STORE_ID_TOKEN = True
OIDC_STORE_ACCESS_TOKEN = True
OIDC_AUTHENTICATION_CALLBACK_URL = "api_oidc_authentication_callback"

OIDC_OP_AUTHORIZATION_ENDPOINT = "https://open-id.up.pt/realms/sigarra/protocol/openid-connect/auth"
OIDC_OP_TOKEN_ENDPOINT = "https://open-id.up.pt/realms/sigarra/protocol/openid-connect/token"
OIDC_OP_USER_ENDPOINT = "https://open-id.up.pt/realms/sigarra/protocol/openid-connect/userinfo"
OIDC_OP_JWKS_ENDPOINT = "https://open-id.up.pt/realms/sigarra/protocol/openid-connect/certs"

OIDC_OP_LOGOUT_ENDPOINT = "https://open-id.up.pt/realms/sigarra/protocol/openid-connect/logout"

OIDC_RP_SCOPES = "openid email profile uporto_data"
Expand Down
2 changes: 0 additions & 2 deletions django/university/routes/auth/Csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class Csrf(View):
def get(self, request):
response = HttpResponse()

print("csrf request cookies is: ", request.COOKIES)

if("csrftoken" not in request.COOKIES):
cookies = request.COOKIES
response.COOKIES = cookies
Expand Down
1 change: 1 addition & 0 deletions django/university/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
path('professors/<int:slot>/', views.professor),
path('course_unit/hash', views.get_course_unit_hashes),
path('oidc-auth/', include('mozilla_django_oidc.urls')),
path('api/oidc-auth/callback/', oidc_views.OIDCAuthenticationCallbackView.as_view(), name="api_oidc_authentication_callback")
]
2 changes: 0 additions & 2 deletions django/university/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ def course_units(request, course_id, year, semester):

return JsonResponse(json_data, safe=False)



"""
Returns the classes of a course unit.
"""
Expand Down
11 changes: 0 additions & 11 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ http {
ssl_certificate_key /etc/nginx/certs/server.key;
server_name tts-dev.niaefeup.pt;

location /oidc-auth/ {
rewrite ^/oidc-auth/(.*)$ /api/oidc-auth/$1 last;

proxy_pass http://tts_django:8000/;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /api/ {
rewrite ^/api/(.*)$ /$1 break;

Expand Down

0 comments on commit 47b6911

Please sign in to comment.