Skip to content

Commit

Permalink
feat: display key names in auth strategy info (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidma415 authored Feb 20, 2024
1 parent 0bc3fd9 commit 19ad014
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 5 deletions.
8 changes: 7 additions & 1 deletion cypress/e2e/specs/application_registration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,8 @@ describe('Application Registration', () => {
auth_strategy: {
id: 'key-auth-strat-id',
name: 'keyauthstrat',
credential_type: AuthStrategyKeyAuthCredentialTypeEnum.KeyAuth
credential_type: AuthStrategyKeyAuthCredentialTypeEnum.KeyAuth,
key_names: ['key']
}
}

Expand All @@ -1276,7 +1277,11 @@ describe('Application Registration', () => {
cy.get('[data-testid="applications-table"] tbody tr').click()
cy.get('[data-testid="auth-strategy-card"]').should('exist')
cy.get('[data-testid="auth-strategy-auth-methods-label"]').should('not.exist')
cy.get('[data-testid="auth-strategy-key-names-label"]').should('exist')
cy.get('[data-testid="auth-strategy-title"]').should('exist').should('contain.text', keyAuthApp.auth_strategy.name)
keyAuthApp.auth_strategy.key_names.forEach((key) => {
cy.get(`[data-testid="key-name-${key}"]`).should('exist')
})
cy.get('[data-testid="auth-strategy-credential-type"]').should('exist').should('contain.text', 'Key Auth')
})
it('app-reg-v2 - does not show any tables if app is oidc ', () => {
Expand Down Expand Up @@ -1340,6 +1345,7 @@ describe('Application Registration', () => {
cy.get('[data-testid="applications-table"] tbody tr').click()
cy.get('[data-testid="auth-strategy-card"]').should('exist')
cy.get('[data-testid="auth-strategy-auth-methods-label"]').should('exist')
cy.get('[data-testid="auth-strategy-key-names-label"]').should('not.exist')
cy.get('[data-testid="auth-strategy-title"]').should('exist').should('contain.text', oidcApp.auth_strategy.name)
cy.get('[data-testid="auth-strategy-credential-type"]').should('exist').should('contain.text', 'Self Managed Client Credentials')
oidcApp.auth_strategy.auth_methods.forEach((method) => {
Expand Down
1 change: 1 addition & 0 deletions src/locales/ca_ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const ca_ES: I18nType = {
credentialTypeLabel: translationNeeded(en.authStrategyInfo.credentialTypeLabel),
registerBtnText: (productVersionName: string) => translationNeeded(en.authStrategyInfo.registerBtnText(productVersionName)),
authMethods: translationNeeded(en.authStrategyInfo.authMethods),
keyNames: translationNeeded(en.authStrategyInfo.keyNames),
bearer: translationNeeded(en.authStrategyInfo.bearer),
keyAuth: translationNeeded(en.authStrategyInfo.keyAuth),
clientCredentials: translationNeeded(en.authStrategyInfo.clientCredentials),
Expand Down
1 change: 1 addition & 0 deletions src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const de: I18nType = {
credentialTypeLabel: translationNeeded(en.authStrategyInfo.credentialTypeLabel),
registerBtnText: (productVersionName: string) => translationNeeded(en.authStrategyInfo.registerBtnText(productVersionName)),
authMethods: translationNeeded(en.authStrategyInfo.authMethods),
keyNames: translationNeeded(en.authStrategyInfo.keyNames),
bearer: translationNeeded(en.authStrategyInfo.bearer),
keyAuth: translationNeeded(en.authStrategyInfo.keyAuth),
clientCredentials: translationNeeded(en.authStrategyInfo.clientCredentials),
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const en = {
credentialTypeLabel: 'Credential Type:',
registerBtnText: (productVersionName: string) => `Register for ${productVersionName}`,
authMethods: 'Auth Methods:',
keyNames: 'Key Names:',
bearer: 'Bearer',
keyAuth: 'Key Auth',
clientCredentials: 'Client Credentials',
Expand Down
1 change: 1 addition & 0 deletions src/locales/es_ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const es_ES: I18nType = {
credentialTypeLabel: translationNeeded(en.authStrategyInfo.credentialTypeLabel),
registerBtnText: (productVersionName: string) => translationNeeded(en.authStrategyInfo.registerBtnText(productVersionName)),
authMethods: translationNeeded(en.authStrategyInfo.authMethods),
keyNames: translationNeeded(en.authStrategyInfo.keyNames),
bearer: translationNeeded(en.authStrategyInfo.bearer),
keyAuth: translationNeeded(en.authStrategyInfo.keyAuth),
clientCredentials: translationNeeded(en.authStrategyInfo.clientCredentials),
Expand Down
1 change: 1 addition & 0 deletions src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const fr: I18nType = {
credentialTypeLabel: translationNeeded(en.authStrategyInfo.credentialTypeLabel),
registerBtnText: (productVersionName: string) => translationNeeded(en.authStrategyInfo.registerBtnText(productVersionName)),
authMethods: translationNeeded(en.authStrategyInfo.authMethods),
keyNames: translationNeeded(en.authStrategyInfo.keyNames),
bearer: translationNeeded(en.authStrategyInfo.bearer),
keyAuth: translationNeeded(en.authStrategyInfo.keyAuth),
clientCredentials: translationNeeded(en.authStrategyInfo.clientCredentials),
Expand Down
1 change: 1 addition & 0 deletions src/locales/i18n-type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface I18nType {
credentialTypeLabel: string;
registerBtnText: (productVersionName: string) => string;
authMethods: string;
keyNames: string;
bearer: string;
keyAuth: string;
clientCredentials: string;
Expand Down
22 changes: 18 additions & 4 deletions src/views/Applications/ApplicationDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@
</KBadge>
</span>
<p
v-if="application.auth_strategy.credential_type !== 'key_auth'"
class="auth-methods-label"
data-testid="auth-strategy-auth-methods-label"
:data-testid="application.auth_strategy.credential_type !== 'key_auth' ? 'auth-strategy-auth-methods-label' : 'auth-strategy-key-names-label'"
>
{{ helpText.authStrategyInfo.authMethods }}
{{ application.auth_strategy.credential_type !== 'key_auth' ? helpText.authStrategyInfo.authMethods : helpText.authStrategyInfo.keyNames }}
</p>
<div class="info-container">
<KCard
Expand All @@ -52,7 +51,7 @@
>
<template #body>
<KBadge
v-for="(authMethod, index) in application.auth_strategy.auth_methods"
v-for="(authMethod, index) in application.auth_strategy?.auth_methods"
:key="authMethod + index"
:data-testid="`auth-method-${authMethod}`"
shape="rectangular"
Expand All @@ -61,6 +60,21 @@
</KBadge>
</template>
</KCard>
<KCard
v-else
class="badge-container"
>
<template #body>
<KBadge
v-for="(keyName, index) in application.auth_strategy?.key_names"
:key="keyName + index"
:data-testid="`key-name-${keyName}`"
shape="rectangular"
>
{{ keyName }}
</KBadge>
</template>
</KCard>
</div>
</template>
</KCard>
Expand Down

0 comments on commit 19ad014

Please sign in to comment.