forked from os2loop/os2loop
-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP] 5124: Cura login #375
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
Open
rimi-itk
wants to merge
15
commits into
release/1.2.5
Choose a base branch
from
feature/5124-cura-login
base: release/1.2.5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
480731d
5124: Experiments
rimi-itk 8391b71
5124: Debugging
rimi-itk 94bef0b
5124: Making progress
rimi-itk 37c677d
5124: Cleaned up composer stuff
rimi-itk 4f23686
5124: Improved stuff
rimi-itk 08dec18
5124: Cleaned up
rimi-itk cdcf3ca
5124: Refactored settings
rimi-itk b57261b
5124: Updated controller actions
rimi-itk 221fb5b
5124: Refactored settings
rimi-itk 479a495
5124: Updated Drush test command
rimi-itk 6cea4ea
5124: Disabled caching on routes
rimi-itk c3e2ad4
5124: Handled `destination` parameter in URL
rimi-itk f267d5f
5124: Updated test command
rimi-itk 9010a2d
5124: Added some logging
rimi-itk 0fed3f4
Update web/profiles/custom/os2loop/modules/os2loop_cura_login/src/Con…
rimi-itk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
web/profiles/custom/os2loop/modules/os2loop_cura_login/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| composer.lock | ||
| vendor/ |
59 changes: 59 additions & 0 deletions
59
web/profiles/custom/os2loop/modules/os2loop_cura_login/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Cura login | ||
|
|
||
| Use `https://os2loop.example.com/os2loop-cura-login/start` as `linkURL` (or is it `formPostUrl`?) in the Cura link | ||
| configuration. | ||
|
|
||
| ## How does it work? | ||
|
|
||
| Cura will make a `POST` `multipart/form-data` request to `/os2loop-cura-login/start` with a `payload` parameter containing | ||
| a JWT like | ||
|
|
||
| ``` json | ||
| { | ||
| "header" : { | ||
| "alg" : "HS256" | ||
| }, | ||
| "payload" : { | ||
| "brugerId" : "az…", | ||
| "organisationsNavn" : "Digitalisering", | ||
| "brugerensNavn" : "…", | ||
| "sorid" : "aarhus", | ||
| "exp" : 1756978913 | ||
| }, | ||
| "signature" : "…" | ||
| } | ||
| ``` | ||
|
|
||
| However, it can also make a `GET` request to `/os2loop-cura-login/start/{payload}` or | ||
| `/os2loop-cura-login/start/payload={payload}`. | ||
|
|
||
| ## Example | ||
|
|
||
| ``` shell | ||
| curl "http://$(docker compose port nginx 8080)/os2loop-cura-login/start" | ||
| ``` | ||
|
|
||
| ``` shell | ||
| drush os2loop-cura-login:get-login-url --help | ||
| ``` | ||
|
|
||
| ``` shell name=drush-get-login-url | ||
| drush os2loop-cura-login:get-login-url az000000 --get=jwt --destination=/user \ | ||
| --algorithm="$(drush config:get --format string os2loop_cura_login.settings cura.signing_algorithm --include-overridden)" \ | ||
| --secret="$(drush config:get --format string os2loop_cura_login.settings cura.signing_secret --include-overridden)" | ||
| ``` | ||
|
|
||
| ## Development and debugging | ||
|
|
||
| ``` php | ||
| # settings.local.php | ||
| $config['os2loop_cura_login.settings']['general']['log_level'] = \Drupal\Core\Logger\RfcLogLevel::DEBUG; | ||
| ``` | ||
|
|
||
| Run | ||
|
|
||
| ``` shell | ||
| drush config:get os2loop_cura_login.settings --include-overridden | ||
| ``` | ||
|
|
||
| to show the current module config. | ||
15 changes: 15 additions & 0 deletions
15
web/profiles/custom/os2loop/modules/os2loop_cura_login/composer.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "os2loop/os2loop_cura_login", | ||
| "description": "drupal/os2loop_cura_login", | ||
| "type": "os2loop-custom-module", | ||
| "license": "GPL-2.0+", | ||
| "authors": [ | ||
| { | ||
| "name": "Mikkel Ricky", | ||
| "email": "rimi@aarhus.dk" | ||
| } | ||
| ], | ||
| "require": { | ||
| "firebase/php-jwt": "^6.11" | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
...les/custom/os2loop/modules/os2loop_cura_login/config/schema/os2loop_cura_login.schema.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Schema for the configuration files of the OS2Loop Cura login module. | ||
| os2loop_cura_login.settings: | ||
| type: config_object | ||
| label: 'OS2Loop Cura login settings' | ||
| mapping: | ||
| example: | ||
| type: string | ||
| label: 'Example' |
10 changes: 10 additions & 0 deletions
10
web/profiles/custom/os2loop/modules/os2loop_cura_login/os2loop_cura_login.info.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| name: "OS2Loop Cura login" | ||
| type: module | ||
| description: "OS2Loop Cura login" | ||
| package: "OS2Loop" | ||
| core_version_requirement: ^10 || ^11 | ||
| dependencies: | ||
| - drupal:user | ||
| - openid_connect:openid_connect | ||
|
|
||
| configure: os2loop_cura_login.settings |
6 changes: 6 additions & 0 deletions
6
web/profiles/custom/os2loop/modules/os2loop_cura_login/os2loop_cura_login.links.menu.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| os2loop_cura_login.settings: | ||
| title: "OS2Loop Cura login settings" | ||
| route_name: os2loop_cura_login.settings | ||
| description: "Configure OS2Loop Cura login settings" | ||
| parent: os2loop.group.admin | ||
| weight: 100 |
40 changes: 40 additions & 0 deletions
40
web/profiles/custom/os2loop/modules/os2loop_cura_login/os2loop_cura_login.routing.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| os2loop_cura_login.start: | ||
| path: "/os2loop-cura-login/start" | ||
| defaults: | ||
| _title: "Start Cura login with POST or GET" | ||
| _controller: '\Drupal\os2loop_cura_login\Controller\Os2loopCuraLoginController::start' | ||
| methods: [GET, POST] | ||
| requirements: | ||
| _user_is_logged_in: "FALSE" | ||
| options: | ||
| no_cache: TRUE | ||
|
|
||
| os2loop_cura_login.start_get_jwt: | ||
| path: "/os2loop-cura-login/start/{jwt}" | ||
| defaults: | ||
| _title: "Start Cura login with JWT in request path" | ||
| _controller: '\Drupal\os2loop_cura_login\Controller\Os2loopCuraLoginController::start' | ||
| methods: [GET] | ||
| requirements: | ||
| _user_is_logged_in: "FALSE" | ||
| options: | ||
| no_cache: TRUE | ||
|
|
||
| os2loop_cura_login.authenticate: | ||
| path: "/os2loop-cura-login/authenticate/{jwt}" | ||
| defaults: | ||
| _title: "Authenticate with Cura login" | ||
| _controller: '\Drupal\os2loop_cura_login\Controller\Os2loopCuraLoginController::authenticate' | ||
| methods: [GET] | ||
| requirements: | ||
| _user_is_logged_in: "FALSE" | ||
| options: | ||
| no_cache: TRUE | ||
|
|
||
| os2loop_cura_login.settings: | ||
| path: "/admin/config/os2loop/os2loop_cura_login/settings" | ||
| defaults: | ||
| _form: '\Drupal\os2loop_cura_login\Form\SettingsForm' | ||
| _title: "OS2Loop Cura login settings" | ||
| requirements: | ||
| _permission: "administer site settings" |
15 changes: 15 additions & 0 deletions
15
web/profiles/custom/os2loop/modules/os2loop_cura_login/os2loop_cura_login.services.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| services: | ||
| _defaults: | ||
| autowire: true | ||
|
|
||
| logger.channel.os2loop_cura_login: | ||
| parent: logger.channel_base | ||
| arguments: ["os2loop_cura_login"] | ||
|
|
||
| Drupal\os2loop_cura_login\Settings: | ||
|
|
||
| Drupal\os2loop_cura_login\CuraHelper: | ||
|
|
||
| Drupal\os2loop_cura_login\IdPHelper: | ||
|
|
||
| Drupal\os2loop_cura_login\UserHelper: |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dansk json ser skørt ud