File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
components/server/src/oauth-server Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { inject, injectable } from "inversify";
15
15
import { URL } from "url" ;
16
16
import { Config } from "../config" ;
17
17
import { clientRepository , createAuthorizationServer } from "./oauth-authorization-server" ;
18
+ import { inMemoryDatabase } from "./db" ;
18
19
19
20
@injectable ( )
20
21
export class OAuthController {
@@ -175,6 +176,17 @@ export class OAuthController {
175
176
}
176
177
} ) ;
177
178
179
+ router . get ( "/oauth/inspect" , async ( req : express . Request , res : express . Response ) => {
180
+ const clientId = req . query . client as string ;
181
+ if ( typeof clientId !== "string" || ! Object . keys ( inMemoryDatabase . clients ) . includes ( clientId ) ) {
182
+ return res . sendStatus ( 400 ) ;
183
+ }
184
+
185
+ const client = inMemoryDatabase . clients [ clientId ] ;
186
+ const scopes = client . scopes . map ( ( s ) => s . name ) ;
187
+ return res . send ( scopes ) ;
188
+ } ) ;
189
+
178
190
return router ;
179
191
}
180
192
}
You can’t perform that action at this time.
0 commit comments