-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
algorithm not needed anymore when decoding the token + add tests for …
…all algorithms
- Loading branch information
1 parent
217abea
commit 01fc41a
Showing
6 changed files
with
177 additions
and
126 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
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 was deleted.
Oops, something went wrong.
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,61 @@ | ||
<VirtualHost *:80> | ||
ServerName testjwt.local | ||
DocumentRoot /var/www/testjwt/ | ||
|
||
AuthJWTExpDelay 1800 | ||
AuthJWTNbfDelay 0 | ||
AuthJWTIss testjwt.local | ||
AuthJWTAud tests | ||
AuthJWTLeeway 10 | ||
|
||
LogLevel auth_jwt:debug | ||
RewriteEngine On | ||
|
||
Alias "/hmac_secured" "/var/www/testjwt" | ||
Alias "/rsa_secured" "/var/www/testjwt" | ||
Alias "/ec_secured" "/var/www/testjwt" | ||
|
||
<Directory /var/www/testjwt/> | ||
AllowOverride None | ||
Options -Indexes | ||
Require all granted | ||
</Directory> | ||
|
||
<Location "/hmac_secured"> | ||
AuthJWTSignatureSharedSecret secret | ||
AllowOverride None | ||
Options -Indexes | ||
AuthType jwt | ||
AuthName "private area" | ||
Require valid-user | ||
</Location> | ||
|
||
<Location "/rsa_secured"> | ||
AuthJWTSignaturePublicKeyFile /tmp/rsa-pub.pem | ||
AllowOverride None | ||
Options -Indexes | ||
AuthType jwt | ||
AuthName "private area" | ||
Require valid-user | ||
</Location> | ||
|
||
<Location "/ec_secured"> | ||
AuthJWTSignaturePublicKeyFile /tmp/ec-pub.pem | ||
AllowOverride None | ||
Options -Indexes | ||
AuthType jwt | ||
AuthName "private area" | ||
Require valid-user | ||
</Location> | ||
|
||
<Location "/jwt_login"> | ||
AuthJWTSignatureAlgorithm HS256 | ||
AuthJWTSignatureSharedSecret secret | ||
SetHandler jwt-login-handler | ||
AuthJWTProvider file | ||
AuthUserFile /var/www/jwt.htpasswd | ||
</Location> | ||
|
||
ErrorLog ${APACHE_LOG_DIR}/error.log | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
</VirtualHost> |
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 |
---|---|---|
@@ -1,17 +1,26 @@ | ||
#!/bin/bash | ||
set -ev | ||
sudo cp apache_hmac.conf /etc/apache2/sites-available/ | ||
sudo mkdir -p /var/www/testjwt/jwt_secured/ | ||
sudo touch /var/www/testjwt/jwt_secured/index.html | ||
sudo cp apache_jwt.conf /etc/apache2/sites-available/ | ||
sudo cp jwt.htpasswd /var/www/jwt.htpasswd | ||
sudo mkdir -p /var/www/testjwt/ | ||
sudo touch /var/www/testjwt/index.html | ||
|
||
if ! sudo a2query -s apache_hmac > /dev/null; then | ||
sudo a2ensite apache_hmac | ||
sudo service apache2 restart | ||
openssl ecparam -name secp256k1 -genkey -noout -out /tmp/ec-priv.pem | ||
openssl ec -in /tmp/ec-priv.pem -pubout -out /tmp/ec-pub.pem | ||
|
||
openssl genpkey -algorithm RSA -out /tmp/rsa-priv.pem -pkeyopt rsa_keygen_bits:4096 | ||
openssl rsa -pubout -in /tmp/rsa-priv.pem -out /tmp/rsa-pub.pem | ||
|
||
if ! sudo a2query -m rewrite > /dev/null; then | ||
sudo a2enmod rewrite | ||
fi | ||
if ! sudo a2query -s apache_jwt > /dev/null; then | ||
sudo a2ensite apache_jwt | ||
fi | ||
sudo service apache2 restart | ||
|
||
if ! grep -q "hmac.testjwt.local" /etc/hosts; then | ||
echo "127.0.0.1 hmac.testjwt.local" | sudo tee --append /etc/hosts > /dev/null | ||
if ! grep -q "testjwt.local" /etc/hosts; then | ||
echo "127.0.0.1 testjwt.local" | sudo tee --append /etc/hosts > /dev/null | ||
fi | ||
|
||
python3 -m unittest discover . -v -f --locals |
Oops, something went wrong.