Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programming exercises: Add tool token support #9408

Draft
wants to merge 90 commits into
base: feature/bearer-support
Choose a base branch
from

Conversation

janthoXO
Copy link
Contributor

@janthoXO janthoXO commented Oct 1, 2024

Tip

This PR stacks on top of feature/bearer-support

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server configured with Gitlab and Jenkins.

Description

Adds an endpoint to generate a new token based on the old token.
This is primarily needed for the online IDE, to pass the artemis token in the redirect

Steps for Testing

Code reviews or testing in Postman with both as-bearer and without would be nice

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Performance Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new method to create JWT cookies with a specific "THEIA" flag.
    • Added functionality to retrieve a Theia token, which can be returned as a cookie or bearer token.
  • Improvements

    • Enhanced JWT extraction and validation process, allowing for tokens to be checked from both cookies and Authorization headers.
    • Updated response handling in the authorization method to return the cookie value instead of an empty response.
  • Bug Fixes

    • Improved error handling for invalid JWT tokens in the new token retrieval method.

@janthoXO janthoXO self-assigned this Oct 1, 2024
@janthoXO janthoXO requested a review from iyannsch October 1, 2024 20:22
@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) core Pull requests that affect the corresponding module labels Oct 1, 2024
@janthoXO janthoXO removed the request for review from iyannsch October 1, 2024 20:22
@krusche
Copy link
Member

krusche commented Oct 2, 2024

As discussed before, I do not think that it is a good idea to offer a re-key functionality from a security point of view. Therefore, I would like to decline this PR and close it.

@janthoXO
Copy link
Contributor Author

janthoXO commented Oct 2, 2024

As discussed before, I do not think that it is a good idea to offer a re-key functionality from a security point of view. Therefore, I would like to decline this PR and close it.

its still a draft, so I would like to first have a discussion about it, before declining this PR.

@krusche
Copy link
Member

krusche commented Oct 2, 2024

As discussed before, I do not think that it is a good idea to offer a re-key functionality from a security point of view. Therefore, I would like to decline this PR and close it.

its still a draft, so I would like to first have a discussion about it, before declining this PR.

We discussed this already several times. I'm not sure if additional discussions help, when my arguments against it are ignored :-(

@janthoXO
Copy link
Contributor Author

janthoXO commented Oct 2, 2024

We discussed this already several times. I'm not sure if additional discussions help, when my arguments against it are ignored :-(

we agreed on a meeting in the afternoon, so please let us have this meeting first

@janthoXO
Copy link
Contributor Author

janthoXO commented Oct 2, 2024

After the meeting the proposed solution looks as follows:

  • re-key is a suboptimal name since it is only used for theia. therefore the endpoint should be renamed
  • the token lifetime should not be extended - best case the token should be valid at max for 1 day
  • the token should contain a theia specific flag
  • the whole functionality depends on the theia profile being active
  • the token is a standard artemis token inheriting all of the original tokens capabilities

@krusche will provide further feedback on that

@janthoXO janthoXO changed the title Add re-key endpoint Programming Exercise Add re-key endpoint Oct 2, 2024
@janthoXO janthoXO changed the title Programming Exercise Add re-key endpoint Programming Exercise: Add re-key endpoint Oct 2, 2024
@janthoXO janthoXO changed the title Programming Exercise: Add re-key endpoint Programming exercises: Add re-key endpoint Oct 2, 2024
@janthoXO janthoXO changed the title Programming exercises: Add re-key endpoint Programming exercises: Add theia token for redirect Oct 2, 2024
@janthoXO janthoXO added the stacked-pr PR that depends on another PR label Oct 4, 2024
@janthoXO janthoXO changed the base branch from develop to feature/bearer-support October 4, 2024 09:48
@janthoXO
Copy link
Contributor Author

janthoXO commented Oct 4, 2024

TODO, make endpoint only available if theia profile is active

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 8, 2024
Copy link

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 15, 2024
@janthoXO janthoXO marked this pull request as ready for review October 15, 2024 13:42
@janthoXO janthoXO requested a review from a team as a code owner October 15, 2024 13:42
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) documentation database Pull requests that update the database. (Added Automatically!). Require a CRITICAL deployment. config-change Pull requests that change the config in a way that they require a deployment via Ansible. docker template playwright assessment Pull requests that affect the corresponding module athena Pull requests that affect the corresponding module atlas Pull requests that affect the corresponding module communication Pull requests that affect the corresponding module exam Pull requests that affect the corresponding module fileupload Pull requests that affect the corresponding module iris Pull requests that affect the corresponding module lecture Pull requests that affect the corresponding module lti Pull requests that affect the corresponding module modeling Pull requests that affect the corresponding module plagiarism Pull requests that affect the corresponding module programming Pull requests that affect the corresponding module quiz Pull requests that affect the corresponding module text Pull requests that affect the corresponding module labels Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assessment Pull requests that affect the corresponding module athena Pull requests that affect the corresponding module atlas Pull requests that affect the corresponding module client Pull requests that update TypeScript code. (Added Automatically!) communication Pull requests that affect the corresponding module config-change Pull requests that change the config in a way that they require a deployment via Ansible. core Pull requests that affect the corresponding module database Pull requests that update the database. (Added Automatically!). Require a CRITICAL deployment. docker documentation exam Pull requests that affect the corresponding module exercise Pull requests that affect the corresponding module fileupload Pull requests that affect the corresponding module iris Pull requests that affect the corresponding module lecture Pull requests that affect the corresponding module lti Pull requests that affect the corresponding module modeling Pull requests that affect the corresponding module plagiarism Pull requests that affect the corresponding module playwright programming Pull requests that affect the corresponding module quiz Pull requests that affect the corresponding module server Pull requests that update Java code. (Added Automatically!) stacked-pr PR that depends on another PR template tests text Pull requests that affect the corresponding module
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.