Skip to content

Commit

Permalink
Fix use_basic_auth_scheme property name (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
uhunnyslack authored Oct 19, 2023
1 parent 94858bf commit 288a284
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
34 changes: 16 additions & 18 deletions src/providers/oauth2/oauth2_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,31 +192,29 @@ Deno.test("SlackManifest() oauth2 providers get set properly with token_url_conf
"token_url_config": {},
},
});
// test with use_basic_authentication_scheme false
const providerKey2 =
"test_provider_with_use_basic_authentication_scheme_false";
// test with use_basic_auth_scheme false
const providerKey2 = "test_provider_with_use_basic_auth_scheme_false";
const Provider2 = DefineOAuth2Provider({
provider_key: providerKey2,
provider_type: Schema.providers.oauth2.CUSTOM,
options: {
"client_id": "123.456",
"scope": ["scope_a", "scope_b"],
"token_url_config": {
"use_basic_authentication_scheme": false,
"use_basic_auth_scheme": false,
},
},
});
// test with use_basic_authentication_scheme true
const providerKey3 =
"test_provider_with_use_basic_authentication_scheme_true";
// test with use_basic_auth_scheme true
const providerKey3 = "test_provider_with_use_basic_auth_scheme_true";
const Provider3 = DefineOAuth2Provider({
provider_key: providerKey3,
provider_type: Schema.providers.oauth2.CUSTOM,
options: {
"client_id": "123.456",
"scope": ["scope_a", "scope_b"],
"token_url_config": {
"use_basic_authentication_scheme": true,
"use_basic_auth_scheme": true,
},
},
});
Expand All @@ -238,31 +236,31 @@ Deno.test("SlackManifest() oauth2 providers get set properly with token_url_conf
assertEquals(exportedManifest.external_auth_providers, {
"oauth2": {
"test_provider_with_token_url_config_unset": Provider1.export(),
"test_provider_with_use_basic_authentication_scheme_false": Provider2
"test_provider_with_use_basic_auth_scheme_false": Provider2
.export(),
"test_provider_with_use_basic_authentication_scheme_true": Provider3
"test_provider_with_use_basic_auth_scheme_true": Provider3
.export(),
},
});
// test with use_basic_authentication_scheme unset
// test with use_basic_auth_scheme unset
assertStrictEquals(
exportedManifest.external_auth_providers?.oauth2
?.test_provider_with_token_url_config_unset?.options
?.token_url_config?.use_basic_authentication_scheme,
?.token_url_config?.use_basic_auth_scheme,
undefined,
);
// test with use_basic_authentication_scheme false
// test with use_basic_auth_scheme false
assertStrictEquals(
exportedManifest.external_auth_providers?.oauth2
?.test_provider_with_use_basic_authentication_scheme_false?.options
?.token_url_config?.use_basic_authentication_scheme,
?.test_provider_with_use_basic_auth_scheme_false?.options
?.token_url_config?.use_basic_auth_scheme,
false,
);
// test with use_basic_authentication_scheme true
// test with use_basic_auth_scheme true
assertStrictEquals(
exportedManifest.external_auth_providers?.oauth2
?.test_provider_with_use_basic_authentication_scheme_true?.options
?.token_url_config?.use_basic_authentication_scheme,
?.test_provider_with_use_basic_auth_scheme_true?.options
?.token_url_config?.use_basic_auth_scheme,
true,
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/providers/oauth2/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type OAuth2ProviderIdentitySchema = {

export type tokenUrlConfigSchema = {
/** Default value is false */
"use_basic_authentication_scheme"?: boolean;
"use_basic_auth_scheme"?: boolean;
};

export type OAuth2ProviderOptions = {
Expand All @@ -42,7 +42,7 @@ export type OAuth2ProviderOptions = {
/** Optional configs for token url. Required for CUSTOM provider types. */
"token_url_config"?: tokenUrlConfigSchema;
/** Identity configuration for your provider. Required for CUSTOM provider types.
* If token_url_config is not present, use_basic_authentication_scheme value is false by default. */
* If token_url_config is not present, use_basic_auth_scheme value is false by default. */
"identity_config"?: OAuth2ProviderIdentitySchema;
/** Optional extras dict for authorization url for your provider. Required for CUSTOM provider types. */
"authorization_url_extras"?: { [key: string]: string };
Expand Down

0 comments on commit 288a284

Please sign in to comment.