diff --git a/src/connector-cli/resources/schemas/authentication-types/oauth2-resource-owner-password.json b/src/connector-cli/resources/schemas/authentication-types/oauth2-resource-owner-password.json index 2578167..1f1d84a 100644 --- a/src/connector-cli/resources/schemas/authentication-types/oauth2-resource-owner-password.json +++ b/src/connector-cli/resources/schemas/authentication-types/oauth2-resource-owner-password.json @@ -1,6 +1,21 @@ { "$schema": "https://json-schema.org/draft-07/schema", - + "$defs": { + "AuthorizatoinServerMetadata": { + "type": "object", + "properties": { + "token_endpoint_auth_methods_supported": { + "type": "array", + "items": { + "type": "string", + "enum": ["client_secret_basic", "client_secret_post"] + } + } + }, + "required": ["token_endpoint_auth_methods_supported"], + "additionalProperties": false + } + }, "type": "object", "properties": { "name": { @@ -27,6 +42,9 @@ "bodyFormat": { "type": "string", "enum": ["applicationJson", "formUrlEncoded"] + }, + "authorizationServerMetadata": { + "$ref": "#/$defs/AuthorizatoinServerMetadata" } }, "required": [ diff --git a/src/connector-cli/resources/schemas/connector-config.json b/src/connector-cli/resources/schemas/connector-config.json index b9e248a..d39bb1b 100644 --- a/src/connector-cli/resources/schemas/connector-config.json +++ b/src/connector-cli/resources/schemas/connector-config.json @@ -37,6 +37,20 @@ "bodyFormat": { "type": "string", "enum": ["applicationJson", "formUrlEncoded"] + }, + "authorizationServerMetadata": { + "type": "object", + "properties": { + "token_endpoint_auth_methods_supported": { + "type": "array", + "items": { + "type": "string", + "enum": ["client_secret_basic", "client_secret_post"] + } + } + }, + "required": ["token_endpoint_auth_methods_supported"], + "additionalProperties": false } }, "required": ["bodyFormat"], diff --git a/src/connector-cli/src/core/error-handling.ts b/src/connector-cli/src/core/error-handling.ts index 143dc26..639f746 100644 --- a/src/connector-cli/src/core/error-handling.ts +++ b/src/connector-cli/src/core/error-handling.ts @@ -10,7 +10,7 @@ export function withErrorHandlerAction( } catch (err) { if (err instanceof ExecutionError) { error(err.message); - return; + process.exit(1); } throw err; } diff --git a/src/connector-cli/src/core/types/gen-types.ts b/src/connector-cli/src/core/types/gen-types.ts index 211731f..a1ea596 100644 --- a/src/connector-cli/src/core/types/gen-types.ts +++ b/src/connector-cli/src/core/types/gen-types.ts @@ -17,7 +17,7 @@ export interface ChiliToken { } export interface Oauth2AuthorizationCode { - authorizationServerMetadata: AuthorizationServerMetadata; + authorizationServerMetadata: Oauth2AuthorizationCodeAuthorizationServerMetadata; clientId: string; clientSecret: string; name?: string; @@ -25,7 +25,7 @@ export interface Oauth2AuthorizationCode { specCustomization?: SpecCustomization; } -export interface AuthorizationServerMetadata { +export interface Oauth2AuthorizationCodeAuthorizationServerMetadata { authorization_endpoint: string; token_endpoint: string; token_endpoint_auth_methods_supported: TokenEndpointAuthMethodsSupported[]; @@ -55,14 +55,19 @@ export interface Oauth2ClientCredentials { } export interface Oauth2ResourceOwnerPassword { - bodyFormat?: RequestContentType; - clientId: string; - clientSecret: string; - name?: string; - password: string; - scope?: string; - tokenEndpoint: string; - username: string; + authorizationServerMetadata?: Oauth2ResourceOwnerPasswordAuthorizationServerMetadata; + bodyFormat?: RequestContentType; + clientId: string; + clientSecret: string; + name?: string; + password: string; + scope?: string; + tokenEndpoint: string; + username: string; +} + +export interface Oauth2ResourceOwnerPasswordAuthorizationServerMetadata { + token_endpoint_auth_methods_supported: TokenEndpointAuthMethodsSupported[]; } export interface StaticKey { @@ -101,7 +106,12 @@ export interface OAuth2AuthorizationCodeSpecCustomization { } export interface OAuth2ResourceOwnerPassword { - bodyFormat: RequestContentType; + authorizationServerMetadata?: OAuth2ResourceOwnerPasswordAuthorizationServerMetadata; + bodyFormat: RequestContentType; +} + +export interface OAuth2ResourceOwnerPasswordAuthorizationServerMetadata { + token_endpoint_auth_methods_supported: TokenEndpointAuthMethodsSupported[]; } export enum SupportedAuth { @@ -326,14 +336,14 @@ const typeMap: any = { { json: "name", js: "name", typ: u(undefined, "") }, ], false), "Oauth2AuthorizationCode": o([ - { json: "authorizationServerMetadata", js: "authorizationServerMetadata", typ: r("AuthorizationServerMetadata") }, + { json: "authorizationServerMetadata", js: "authorizationServerMetadata", typ: r("Oauth2AuthorizationCodeAuthorizationServerMetadata") }, { json: "clientId", js: "clientId", typ: "" }, { json: "clientSecret", js: "clientSecret", typ: "" }, { json: "name", js: "name", typ: u(undefined, "") }, { json: "scope", js: "scope", typ: u(undefined, "") }, { json: "specCustomization", js: "specCustomization", typ: u(undefined, r("SpecCustomization")) }, ], false), - "AuthorizationServerMetadata": o([ + "Oauth2AuthorizationCodeAuthorizationServerMetadata": o([ { json: "authorization_endpoint", js: "authorization_endpoint", typ: "" }, { json: "token_endpoint", js: "token_endpoint", typ: "" }, { json: "token_endpoint_auth_methods_supported", js: "token_endpoint_auth_methods_supported", typ: a(r("TokenEndpointAuthMethodsSupported")) }, @@ -350,6 +360,7 @@ const typeMap: any = { { json: "tokenEndpoint", js: "tokenEndpoint", typ: "" }, ], false), "Oauth2ResourceOwnerPassword": o([ + { json: "authorizationServerMetadata", js: "authorizationServerMetadata", typ: u(undefined, r("Oauth2ResourceOwnerPasswordAuthorizationServerMetadata")) }, { json: "bodyFormat", js: "bodyFormat", typ: u(undefined, r("RequestContentType")) }, { json: "clientId", js: "clientId", typ: "" }, { json: "clientSecret", js: "clientSecret", typ: "" }, @@ -359,6 +370,9 @@ const typeMap: any = { { json: "tokenEndpoint", js: "tokenEndpoint", typ: "" }, { json: "username", js: "username", typ: "" }, ], false), + "Oauth2ResourceOwnerPasswordAuthorizationServerMetadata": o([ + { json: "token_endpoint_auth_methods_supported", js: "token_endpoint_auth_methods_supported", typ: a(r("TokenEndpointAuthMethodsSupported")) }, + ], false), "StaticKey": o([ { json: "key", js: "key", typ: "" }, { json: "name", js: "name", typ: u(undefined, "") }, @@ -389,8 +403,12 @@ const typeMap: any = { { json: "requestContentType", js: "requestContentType", typ: u(undefined, r("RequestContentType")) }, ], false), "OAuth2ResourceOwnerPassword": o([ + { json: "authorizationServerMetadata", js: "authorizationServerMetadata", typ: u(undefined, r("OAuth2ResourceOwnerPasswordAuthorizationServerMetadata")) }, { json: "bodyFormat", js: "bodyFormat", typ: r("RequestContentType") }, ], false), + "OAuth2ResourceOwnerPasswordAuthorizationServerMetadata": o([ + { json: "token_endpoint_auth_methods_supported", js: "token_endpoint_auth_methods_supported", typ: a(r("TokenEndpointAuthMethodsSupported")) }, + ], false), "TokenEndpointAuthMethodsSupported": [ "client_secret_basic", "client_secret_post",