Show redirect-uri in client view
Change-Id: Ie5af2db8608d5d37c1b5f37a5e2f4a509706265c
diff --git a/Changes b/Changes
index f47c190..4a33038 100755
--- a/Changes
+++ b/Changes
@@ -1,5 +1,6 @@
-0.50 2023-03-27
+0.50 2023-04-03
- Improvement of NKJP-annotation helper. (diewald)
+ - Add redirect-uri to client view. (diewald)
0.49 2023-02-23
- Introduce conllu2korapxml command via plugin. (diewald)
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index c36c8a2..98a3299 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -8,7 +8,7 @@
use List::Util qw!none uniq!;
# Minor version - may be patched from package.json
-our $VERSION = '0.49';
+our $VERSION = '0.50';
# Supported version of Backend API
our $API_VERSION = '1.0';
diff --git a/lib/Kalamar/Plugin/Auth.pm b/lib/Kalamar/Plugin/Auth.pm
index 5fd3578..183fff2 100644
--- a/lib/Kalamar/Plugin/Auth.pm
+++ b/lib/Kalamar/Plugin/Auth.pm
@@ -97,7 +97,7 @@
revokeFail => 'Der Token kann nicht widerrufen werden',
revokeSuccess => 'Der Token wurde erfolgreich widerrufen',
paramError => 'Einige Eingaben sind fehlerhaft',
- redirectUri => 'Weiterleitungs-Adresse',
+ redirectUri => 'Weiterleitungsadresse',
pluginSrc => 'Beschreibung des Plugins (*.json-Datei)',
homepage => 'Webseite',
desc => 'Kurzbeschreibung',
@@ -987,40 +987,6 @@
}
)->name('oauth-settings');
- # Route to oauth settings
- $r->get('/settings/oauth')->to(
- cb => sub {
- my $c = shift;
-
- _set_no_cache($c->res->headers);
-
- unless ($c->auth->token) {
- return $c->render(
- template => 'exception',
- msg => $c->loc('Auth_authenticationFail'),
- status => 401
- );
- };
-
- # Wait for async result
- $c->render_later;
-
- $c->auth->client_list_p->then(
- sub {
- $c->stash('client_list' => shift);
- }
- )->catch(
- sub {
- return;
- }
- )->finally(
- sub {
- return $c->render(template => 'auth/clients')
- }
- );
- }
- )->name('oauth-settings');
-
# Route to oauth client registration
$r->post('/settings/oauth/register')->to(
cb => sub {
@@ -1556,6 +1522,7 @@
$c->stash(client_desc => $item->{client_description});
$c->stash(client_url => $item->{client_url});
$c->stash(client_type => ($item->{client_type} // 'PUBLIC'));
+ $c->stash(client_redirect_uri => $item->{client_redirect_uri});
$c->stash(client_src => encode_json($item->{source})) if $item->{source};
$c->auth->token_list_p($c->stash('client_id'));
diff --git a/package.json b/package.json
index 7aa0d03..1b2e111 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "Kalamar",
"description": "Mojolicious-based Frontend for KorAP",
"license": "BSD-2-Clause",
- "version": "0.49.0",
+ "version": "0.50.0",
"pluginVersion": "0.2.2",
"engines": {
"node": ">=6.0.0"
diff --git a/t/plugin/auth-oauth.t b/t/plugin/auth-oauth.t
index dfe9fc0..10fd3d7 100644
--- a/t/plugin/auth-oauth.t
+++ b/t/plugin/auth-oauth.t
@@ -864,6 +864,15 @@
"client_redirect_uri" => 'http://redirect.url/'
});
+$t->get_ok('/settings/oauth/xyz2')
+ ->status_is(200)
+ ->text_is('li.client span.client-name','New added client')
+ ->attr_is('li.client p.client-url a','href','http://example.com')
+ ->attr_is('li.client input[name=client_id]','value','xyz2')
+ ->element_exists('li.client p.client-type-confidential')
+ ->text_is('li.client p.client-redirect-uri tt','http://redirect.url/')
+ ;
+
$fwd = $t->get_ok(Mojo::URL->new('/settings/oauth/authorize')->query({
client_id => 'xyz2',
scope => 'search match',