List tokens of a client
Change-Id: Ib4752a9f4fc502f79fefd870857405634ef5ebb9
diff --git a/t/plugin/auth-oauth.t b/t/plugin/auth-oauth.t
index adb7378..4f0d67a 100644
--- a/t/plugin/auth-oauth.t
+++ b/t/plugin/auth-oauth.t
@@ -556,11 +556,12 @@
name => 'MyApp2',
'client-id' => 'fCBbQkA2NDA3MzM1Yw=='
})
- ->status_is(200)
- ->attr_is('input[name=access_token]', 'value', 'jvgjbvjgzucgdwuiKHJK')
- ->text_is('p[name=expires] tt', '31536000')
- ->text_is('p[name=scope] tt', 'match_info search openid')
- ->text_is('p[name=type] tt', 'Bearer')
+ ->status_is(302)
+ ->header_is('Location','/settings/oauth/client/fCBbQkA2NDA3MzM1Yw==')
+ ;
+
+$t->get_ok('/settings/oauth/client/fCBbQkA2NDA3MzM1Yw==')
+ ->text_is('div.notify-success', 'New access token created')
;
diff --git a/t/server/mock.pl b/t/server/mock.pl
index 43f4f5f..7e3eedb 100644
--- a/t/server/mock.pl
+++ b/t/server/mock.pl
@@ -544,8 +544,8 @@
push @$list, {
"client_id" => $tokens{new_client_id},
"client_name" => $name,
- "description" => $desc,
- "url" => $url
+ "client_description" => $desc,
+ "client_url" => $url
};
# Confidential server application
@@ -577,6 +577,29 @@
);
};
+
+# Get token list
+post '/v1.0/oauth2/token/list' => sub {
+ my $c = shift;
+ return $c->render(json => [
+ {
+ "client_description" => "Nur ein Beispiel",
+ "client_id" => $tokens{new_client_id},
+ "client_name" => "Beispiel",
+ "client_url" => "",
+ "created_date" => "2021-04-14T19:40:26.742+02:00[Europe\/Berlin]",
+ "expires_in" => "31533851",
+ "scope" => [
+ "match_info",
+ "search",
+ "openid"
+ ],
+ "token" => "jhkhkjhk_hjgjsfz67i",
+ "user_authentication_time" => "2021-04-14T19:39:41.81+02:00[Europe\/Berlin]"
+ }
+ ]);
+};
+
del '/v1.0/oauth2/client/deregister/:client_id' => sub {
my $c = shift;
my $client_id = $c->stash('client_id');