@@ -46,6 +46,22 @@ impl std::fmt::Display for OAuth2SessionStatus {
46
46
}
47
47
}
48
48
49
+ #[ derive( Deserialize , JsonSchema , Clone , Copy ) ]
50
+ #[ serde( rename_all = "snake_case" ) ]
51
+ enum OAuth2ClientKind {
52
+ Dynamic ,
53
+ Static ,
54
+ }
55
+
56
+ impl std:: fmt:: Display for OAuth2ClientKind {
57
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
58
+ match self {
59
+ Self :: Dynamic => write ! ( f, "dynamic" ) ,
60
+ Self :: Static => write ! ( f, "static" ) ,
61
+ }
62
+ }
63
+ }
64
+
49
65
#[ derive( FromRequestParts , Deserialize , JsonSchema , OperationIo ) ]
50
66
#[ serde( rename = "OAuth2SessionFilter" ) ]
51
67
#[ aide( input_with = "Query<FilterParams>" ) ]
@@ -61,6 +77,10 @@ pub struct FilterParams {
61
77
#[ schemars( with = "Option<crate::admin::schema::Ulid>" ) ]
62
78
client : Option < Ulid > ,
63
79
80
+ /// Retrieve the items only for a specific client kind
81
+ #[ serde( rename = "filter[client-kind]" ) ]
82
+ client_kind : Option < OAuth2ClientKind > ,
83
+
64
84
/// Retrieve the items started from the given browser session
65
85
#[ serde( rename = "filter[user-session]" ) ]
66
86
#[ schemars( with = "Option<crate::admin::schema::Ulid>" ) ]
@@ -95,6 +115,11 @@ impl std::fmt::Display for FilterParams {
95
115
sep = '&' ;
96
116
}
97
117
118
+ if let Some ( client_kind) = self . client_kind {
119
+ write ! ( f, "{sep}filter[client-kind]={client_kind}" ) ?;
120
+ sep = '&' ;
121
+ }
122
+
98
123
if let Some ( user_session) = self . user_session {
99
124
write ! ( f, "{sep}filter[user-session]={user_session}" ) ?;
100
125
sep = '&' ;
@@ -232,6 +257,12 @@ pub async fn handler(
232
257
None => filter,
233
258
} ;
234
259
260
+ let filter = match params. client_kind {
261
+ Some ( OAuth2ClientKind :: Dynamic ) => filter. only_dynamic_clients ( ) ,
262
+ Some ( OAuth2ClientKind :: Static ) => filter. only_static_clients ( ) ,
263
+ None => filter,
264
+ } ;
265
+
235
266
let user_session = if let Some ( user_session_id) = params. user_session {
236
267
let user_session = repo
237
268
. browser_session ( )
0 commit comments