Skip to content

Commit

Permalink
feat(portal-next): display username + password for native kafka api k…
Browse files Browse the repository at this point in the history
…ey access
  • Loading branch information
jourdiw committed Dec 18, 2024
1 parent b6e1705 commit 407511e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
<div class="m3-title-medium api-access__header" i18n="@@subscriptionDetailsApiAccessHeader">API access</div>
</mat-card-header>
<mat-card-content class="api-access__copy-code-content">
@if (planSecurity === 'API_KEY') {
<app-copy-code id="api-key" class="test-1" title="API Key" [text]="apiKey ?? ''" />
} @else if (planSecurity === 'OAUTH2' || planSecurity === 'JWT') {
@if (planSecurity === 'OAUTH2' || planSecurity === 'JWT') {
<app-copy-code id="client-id" title="Client ID" [text]="clientId ?? ''" />

@if (!!clientSecret) {
Expand All @@ -39,6 +37,9 @@
[apiKeyConfigUsername]="apiKeyConfigUsername ?? ''"
[clientId]="clientId ?? ''" />
} @else if (planSecurity === 'KEY_LESS' || planSecurity === 'API_KEY') {
@if (planSecurity === 'API_KEY') {
<app-copy-code id="api-key" class="test-1" title="API Key" [text]="apiKey ?? ''" />
}
<app-copy-code id="base-url" title="Base URL" [text]="entrypointUrl ?? ''" />
<app-copy-code id="command-line" title="Command Line" [text]="curlCmd" />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,12 @@ describe('ApiAccessComponent', () => {
component.apiKeyConfigUsername = 'hash-username';

fixture.detectChanges();
expect(await apiKeyShown()).toBeTruthy();
expect(await apiKeyShown()).toBeFalsy();
expect(await baseUrlShown()).toBeFalsy();
expect(await commandLineShown()).toBeFalsy();

expect(await apiKeyUsernameShown()).toBeTruthy();
expect(await apiKeyPasswordShown()).toBeTruthy();
expect(await plainConfigurationShown()).toBeTruthy();
expect(await scram256ConfigurationShown()).toBeFalsy();
expect(await scram512ConfigurationShown()).toBeFalsy();
Expand Down Expand Up @@ -244,6 +247,12 @@ describe('ApiAccessComponent', () => {
async function apiKeyShown() {
return !!(await getCopyCodeHarnessOrNullByTitle('API Key'));
}
async function apiKeyUsernameShown() {
return !!(await getCopyCodeHarnessOrNullByTitle('Username'));
}
async function apiKeyPasswordShown() {
return !!(await getCopyCodeHarnessOrNullByTitle('Password'));
}
async function baseUrlShown() {
return !!(await getCopyCodeHarnessOrNullByTitle('Base URL'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
</div>
</div>

@if (planSecurity() === 'API_KEY') {
<div class="native-kafka-api-access__section">
<div class="m3-title-medium" i18n="@@nativeKafkaApiAccessAuthentication">Authentication</div>
<div class="m3-body-medium" i18n="@@nativeKafkaApiAccessApiKeyHash">
Use the MD5 hash of the API Key as the username and the API Key as the password.
</div>
<app-copy-code id="native-kafka-api-key-username" title="Username" [text]="apiKeyConfigUsername()" />
<app-copy-code id="native-kafka-api-key-password" title="Password" [text]="apiKey()" />
</div>
}

<div class="native-kafka-api-access__section">
<div class="m3-title-medium" i18n="@@nativeKafkaApiAccessReviewProperties">Review Kafka Properties</div>
<div class="m3-body-medium" i18n="@@nativeKafkaApiAccessCreatePropertiesFile">
Expand Down

0 comments on commit 407511e

Please sign in to comment.