-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from cultuurnet/III-6207-keycloak-jwt
III-6207 keycloak jwt
- Loading branch information
Showing
8 changed files
with
121 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
config.yml | ||
/log | ||
/.php_cs.cache | ||
.phpunit.result.cache | ||
.phpunit.result.cache | ||
|
This file contains 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 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 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,39 @@ | ||
# JWTProvider with Docker | ||
|
||
## Prerequisite | ||
- Install Docker Desktop | ||
- appconfig: you'll have to clone [appconfig](https://github.com/cultuurnet/appconfig) in the same folder as where you will clone [udb3-backend](https://github.com/cultuurnet/udb3-backend) | ||
|
||
## Configure | ||
|
||
``` | ||
$ make config | ||
``` | ||
|
||
## Start | ||
|
||
### Docker | ||
|
||
Start the docker containers with the following command. Make sure to execute this inside the root of the project. | ||
``` | ||
$ make up | ||
``` | ||
|
||
### Composer packages | ||
|
||
To install all composer packages & migrate the database, run the following command: | ||
``` | ||
$ make init | ||
``` | ||
|
||
### CI | ||
|
||
To execute all CI tasks, run the following command: | ||
``` | ||
$ make ci | ||
``` | ||
|
||
### Debugging | ||
|
||
For local debugging purposes, a sample `jwt-example.php` is included in the `web`-folder. | ||
To test it go to http://localhost:9999/jwt-example.php |
This file contains 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,9 @@ | ||
#!/bin/sh | ||
|
||
DIR="../appconfig/files/udb3/docker/jwt-provider/" | ||
if [ -d "$DIR" ]; then | ||
cp -R "$DIR"/* . | ||
else | ||
echo "Error: missing appconfig see docker.md prerequisites to fix this." | ||
exit 1 | ||
fi |
This file contains 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 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 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,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
session_start(); | ||
|
||
if ($_SERVER['HTTP_HOST'] === 'localhost') { | ||
header('response-code: 400'); | ||
die('Access denied.'); | ||
} | ||
|
||
$url = urlencode('http://localhost:9999/jwt-example.php?apiKey=f3527f1c-210f-4075-99d3-ece98cf2b391'); | ||
?> | ||
|
||
<ul> | ||
<li><a href="http://localhost:9999/connect?destination=<?php echo $url?>">Connect without apiKey</a></li> | ||
<li><a href="http://localhost:9999/connect?apiKey=f3527f1c-210f-4075-99d3-ece98cf2b391&destination=<?php echo $url?>">Connect with apiKey</a></li> | ||
<li><a href="http://localhost:9999/logout?destination=<?php echo $url?>">Logout</a></li> | ||
<li><a href="http://localhost:9999/logout-confirm">Logout confirm</a></li> | ||
<li><a href="http://localhost:9999/refresh?apiKey=f3527f1c-210f-4075-99d3-ece98cf2b391&refresh=<?php echo $_GET['refresh'] ?? '' ?>">Refresh</a></li> | ||
</ul> | ||
|
||
<style> | ||
td { | ||
word-wrap: anywhere; | ||
} | ||
</style> | ||
|
||
<?php | ||
if (!empty($_GET)) { | ||
echo '<table border="1">'; | ||
echo '<tr><th>Parameter</th><th>Value</th></tr>'; | ||
foreach ($_GET as $key => $value) { | ||
echo '<tr><td>' . htmlspecialchars($key) . '</td><td>' . htmlspecialchars($value) . '</td></tr>'; | ||
} | ||
echo '</table>'; | ||
} |