Deprecate JWT flow in favor of OAuth2 flow
Change-Id: I98f44d80be07dfd4bf97bcbd30510128fd035a46
diff --git a/Changes b/Changes
index 2e16e4b..93498a8 100755
--- a/Changes
+++ b/Changes
@@ -23,6 +23,9 @@
exceptions in Mojo >= 9.0.
- Support revocation of tokens.
- Disable caching in auth routes.
+ - Deprecate JWT flow. In the future only OAuth2
+ flow will be supported and will be the default
+ option for authentication and authorization.
WARNING: Upgrading to Mojolicious 9.19 will
invalidate all sessions. This is a security update.
diff --git a/lib/Kalamar/Plugin/Auth.pm b/lib/Kalamar/Plugin/Auth.pm
index 29dbe36..9dba14c 100644
--- a/lib/Kalamar/Plugin/Auth.pm
+++ b/lib/Kalamar/Plugin/Auth.pm
@@ -3,6 +3,7 @@
use File::Basename 'dirname';
use File::Spec::Functions qw/catdir/;
use Mojo::ByteStream 'b';
+use Mojo::Util 'deprecated';
# This is a plugin to deal with the Kustvakt OAuth server.
# It establishes both the JWT as well as the OAuth password
@@ -1218,9 +1219,10 @@
}
# Use JWT login
- # (should be deprecated)
else {
+ deprecated 'JWT flow is deprecated in favor of OAuth2 flow';
+
# Inject authorization to all korap requests
$app->hook(
before_korap_request => sub {
diff --git a/t/plugin/auth.t b/t/plugin/auth.t
index bd9a3b1..1d1a375 100644
--- a/t/plugin/auth.t
+++ b/t/plugin/auth.t
@@ -13,7 +13,10 @@
my $t = Test::Mojo->new('Kalamar' => {
Kalamar => {
- plugins => ['Auth']
+ plugins => ['Auth'],
+ },
+ 'Kalamar-Auth' => {
+ jwt => 1
}
});
diff --git a/t/plugin/query_reference.t b/t/plugin/query_reference.t
index 97b7345..4fdcf09 100644
--- a/t/plugin/query_reference.t
+++ b/t/plugin/query_reference.t
@@ -14,6 +14,11 @@
my $t = Test::Mojo->new('Kalamar' => {
Kalamar => {
plugins => ['Auth','QueryReference']
+ },
+ 'Kalamar-Auth' => {
+ client_id => 2,
+ client_secret => 'k414m4r-s3cr3t',
+ oauth2 => 1
}
});
diff --git a/t/proxy.t b/t/proxy.t
index 518d7a4..1db8ac9 100644
--- a/t/proxy.t
+++ b/t/proxy.t
@@ -16,6 +16,11 @@
plugins => ['Auth'],
proxy_inactivity_timeout => 99,
proxy_connect_timeout => 66,
+ },
+ 'Kalamar-Auth' => {
+ client_id => 2,
+ client_secret => 'k414m4r-s3cr3t',
+ oauth2 => 1
}
});
diff --git a/t/subfolder.t b/t/subfolder.t
index d13fdc1..f1e5730 100644
--- a/t/subfolder.t
+++ b/t/subfolder.t
@@ -7,6 +7,11 @@
my $t = Test::Mojo->new('Kalamar' => {
Kalamar => {
plugins => ['Auth']
+ },
+ 'Kalamar-Auth' => {
+ client_id => 2,
+ client_secret => 'k414m4r-s3cr3t',
+ oauth2 => 1
}
});
@@ -37,6 +42,11 @@
Kalamar => {
plugins => ['Auth'],
https_only => 1
+ },
+ 'Kalamar-Auth' => {
+ client_id => 2,
+ client_secret => 'k414m4r-s3cr3t',
+ oauth2 => 1
}
});
@@ -59,6 +69,11 @@
plugins => ['Auth'],
proxy_prefix => '/korap/test',
https_only => 1
+ },
+ 'Kalamar-Auth' => {
+ client_id => 2,
+ client_secret => 'k414m4r-s3cr3t',
+ oauth2 => 1
}
});