Validate existing passwords
This commit is contained in:
parent
e6612b2a9c
commit
71aecfb51b
|
@ -88,6 +88,15 @@ export async function validate(
|
|||
clientSecret: body.clientSecret,
|
||||
}
|
||||
|
||||
if (config.clientSecret === PASSWORD_REPLACEMENT && body.id) {
|
||||
const existingConfig = await sdk.oauth2.get(body.id)
|
||||
if (!existingConfig) {
|
||||
ctx.throw(`OAuth2 config with id '${body.id}' not found.`, 404)
|
||||
}
|
||||
|
||||
config.clientSecret = existingConfig.clientSecret
|
||||
}
|
||||
|
||||
const validation = await sdk.oauth2.validateConfig(config)
|
||||
ctx.status = 201
|
||||
ctx.body = validation
|
||||
|
|
|
@ -39,7 +39,7 @@ router.delete(
|
|||
controller.remove
|
||||
)
|
||||
router.post(
|
||||
"/api/oauth2/:id/validate",
|
||||
"/api/oauth2/validate",
|
||||
authorized(PermissionType.BUILDER),
|
||||
controller.validate
|
||||
)
|
||||
|
|
|
@ -22,6 +22,7 @@ export interface UpsertOAuth2ConfigResponse {
|
|||
}
|
||||
|
||||
export interface ValidateConfigRequest {
|
||||
id?: string
|
||||
url: string
|
||||
clientId: string
|
||||
clientSecret: string
|
||||
|
|
Loading…
Reference in New Issue