Check inactive OAuth2 clients
This commit is contained in:
parent
88c4dedceb
commit
5171f1fc0f
@ -80,7 +80,7 @@ export class OAuth2AuthorizationController {
|
||||
// console.debug('Parameter grant_type is', grantTypes.join(' '));
|
||||
|
||||
const client = await OAuth2Clients.fetchById(clientId);
|
||||
if (!client) {
|
||||
if (!client || client.activated === 0) {
|
||||
throw new InvalidClient('Client not found');
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { ApiUtils } from '$lib/server/api-utils';
|
||||
import { AccessDenied } from '../error';
|
||||
import { OAuth2AccessTokens, type OAuth2AccessToken } from '../model';
|
||||
|
||||
@ -28,7 +29,7 @@ export class OAuth2BearerController {
|
||||
} else if (url?.searchParams.has('access_token')) {
|
||||
token = url.searchParams.get('access_token') as string;
|
||||
} else {
|
||||
const body = await request.json().catch(() => ({}));
|
||||
const body = await ApiUtils.getJsonOrFormBody(request);
|
||||
if (!body.access_token) {
|
||||
throw new AccessDenied('Bearer token not found');
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ export class OAuth2IntrospectionController {
|
||||
|
||||
const client = await OAuth2Clients.fetchById(clientId);
|
||||
|
||||
if (!client) {
|
||||
if (!client || client.activated === 0) {
|
||||
throw new InvalidClient('Client not found');
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ export class OAuth2TokenController {
|
||||
|
||||
const client = await OAuth2Clients.fetchById(clientId);
|
||||
|
||||
if (!client) {
|
||||
if (!client || client.activated === 0) {
|
||||
throw new InvalidClient('Client not found');
|
||||
}
|
||||
|
||||
|
@ -165,6 +165,10 @@ export class OAuth2Codes {
|
||||
}
|
||||
|
||||
const client = await OAuth2Clients.fetchById(find.clientId as number);
|
||||
if (!client || client.activated === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
...find,
|
||||
clientIdPub: client.client_id,
|
||||
@ -227,6 +231,10 @@ export class OAuth2AccessTokens {
|
||||
}
|
||||
|
||||
const client = await OAuth2Clients.fetchById(find.clientId as number);
|
||||
if (!client || client.activated === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
...find,
|
||||
clientIdPub: client.client_id
|
||||
@ -291,6 +299,10 @@ export class OAuth2RefreshTokens {
|
||||
}
|
||||
|
||||
const client = await OAuth2Clients.fetchById(find.clientId as number);
|
||||
if (!client || client.activated === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
...find,
|
||||
clientIdPub: client.client_id
|
||||
|
Loading…
Reference in New Issue
Block a user