web/admin: display token's intents

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-23 16:33:12 +02:00
parent d05562a388
commit c4832206fa
4 changed files with 83 additions and 3 deletions

View File

@ -63,6 +63,10 @@ msgstr "ANY, any policy must match to grant access."
msgid "ANY, any policy must match to include this stage access." msgid "ANY, any policy must match to include this stage access."
msgstr "ANY, any policy must match to include this stage access." msgstr "ANY, any policy must match to include this stage access."
#: src/pages/tokens/TokenListPage.ts
msgid "API Access"
msgstr "API Access"
#: src/pages/stages/authenticator_duo/AuthenticatorDuoStageForm.ts #: src/pages/stages/authenticator_duo/AuthenticatorDuoStageForm.ts
msgid "API Hostname" msgid "API Hostname"
msgstr "API Hostname" msgstr "API Hostname"
@ -231,6 +235,10 @@ msgstr "Always require consent"
msgid "App" msgid "App"
msgstr "App" msgstr "App"
#: src/pages/tokens/TokenListPage.ts
msgid "App password"
msgstr "App password"
#: src/elements/user/UserConsentList.ts #: src/elements/user/UserConsentList.ts
#: src/pages/admin-overview/TopApplicationsTable.ts #: src/pages/admin-overview/TopApplicationsTable.ts
#: src/pages/providers/ProviderListPage.ts #: src/pages/providers/ProviderListPage.ts
@ -952,6 +960,11 @@ msgstr "Copy recovery link"
msgid "Create" msgid "Create"
msgstr "Create" msgstr "Create"
#: src/pages/user-settings/tokens/UserTokenList.ts
#: src/pages/user-settings/tokens/UserTokenList.ts
msgid "Create App password"
msgstr "Create App password"
#: src/pages/applications/ApplicationListPage.ts #: src/pages/applications/ApplicationListPage.ts
#: src/pages/providers/RelatedApplicationButton.ts #: src/pages/providers/RelatedApplicationButton.ts
msgid "Create Application" msgid "Create Application"
@ -1018,6 +1031,7 @@ msgstr "Create Stage binding"
msgid "Create Tenant" msgid "Create Tenant"
msgstr "Create Tenant" msgstr "Create Tenant"
#: src/pages/user-settings/tokens/UserTokenList.ts
#: src/pages/user-settings/tokens/UserTokenList.ts #: src/pages/user-settings/tokens/UserTokenList.ts
msgid "Create Token" msgid "Create Token"
msgstr "Create Token" msgstr "Create Token"
@ -2047,6 +2061,11 @@ msgstr "Integration key"
msgid "Integrations" msgid "Integrations"
msgstr "Integrations" msgstr "Integrations"
#: src/pages/tokens/TokenListPage.ts
#: src/pages/user-settings/tokens/UserTokenList.ts
msgid "Intent"
msgstr "Intent"
#: src/pages/providers/proxy/ProxyProviderViewPage.ts #: src/pages/providers/proxy/ProxyProviderViewPage.ts
msgid "Internal Host" msgid "Internal Host"
msgstr "Internal Host" msgstr "Internal Host"
@ -3203,6 +3222,7 @@ msgid "Receive a push notification on your phone to prove your identity."
msgstr "Receive a push notification on your phone to prove your identity." msgstr "Receive a push notification on your phone to prove your identity."
#: src/pages/flows/FlowForm.ts #: src/pages/flows/FlowForm.ts
#: src/pages/tokens/TokenListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
msgid "Recovery" msgid "Recovery"
msgstr "Recovery" msgstr "Recovery"
@ -4388,10 +4408,13 @@ msgstr "Token(s)"
#: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts #: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts
#: src/interfaces/AdminInterface.ts #: src/interfaces/AdminInterface.ts
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts
#: src/pages/user-settings/UserSettingsPage.ts
msgid "Tokens" msgid "Tokens"
msgstr "Tokens" msgstr "Tokens"
#: src/pages/user-settings/UserSettingsPage.ts
msgid "Tokens and App passwords"
msgstr "Tokens and App passwords"
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts
msgid "Tokens are used throughout authentik for Email validation stages, Recovery keys and API access." msgid "Tokens are used throughout authentik for Email validation stages, Recovery keys and API access."
msgstr "Tokens are used throughout authentik for Email validation stages, Recovery keys and API access." msgstr "Tokens are used throughout authentik for Email validation stages, Recovery keys and API access."
@ -4859,6 +4882,10 @@ msgstr "Validation Policies"
msgid "Validity days" msgid "Validity days"
msgstr "Validity days" msgstr "Validity days"
#: src/pages/tokens/TokenListPage.ts
msgid "Verification"
msgstr "Verification"
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
msgid "Verification Certificate" msgid "Verification Certificate"
msgstr "Verification Certificate" msgstr "Verification Certificate"

View File

@ -63,6 +63,10 @@ msgstr ""
msgid "ANY, any policy must match to include this stage access." msgid "ANY, any policy must match to include this stage access."
msgstr "" msgstr ""
#: src/pages/tokens/TokenListPage.ts
msgid "API Access"
msgstr ""
#: src/pages/stages/authenticator_duo/AuthenticatorDuoStageForm.ts #: src/pages/stages/authenticator_duo/AuthenticatorDuoStageForm.ts
msgid "API Hostname" msgid "API Hostname"
msgstr "" msgstr ""
@ -231,6 +235,10 @@ msgstr ""
msgid "App" msgid "App"
msgstr "" msgstr ""
#: src/pages/tokens/TokenListPage.ts
msgid "App password"
msgstr ""
#: src/elements/user/UserConsentList.ts #: src/elements/user/UserConsentList.ts
#: src/pages/admin-overview/TopApplicationsTable.ts #: src/pages/admin-overview/TopApplicationsTable.ts
#: src/pages/providers/ProviderListPage.ts #: src/pages/providers/ProviderListPage.ts
@ -946,6 +954,11 @@ msgstr ""
msgid "Create" msgid "Create"
msgstr "" msgstr ""
#: src/pages/user-settings/tokens/UserTokenList.ts
#: src/pages/user-settings/tokens/UserTokenList.ts
msgid "Create App password"
msgstr ""
#: src/pages/applications/ApplicationListPage.ts #: src/pages/applications/ApplicationListPage.ts
#: src/pages/providers/RelatedApplicationButton.ts #: src/pages/providers/RelatedApplicationButton.ts
msgid "Create Application" msgid "Create Application"
@ -1012,6 +1025,7 @@ msgstr ""
msgid "Create Tenant" msgid "Create Tenant"
msgstr "" msgstr ""
#: src/pages/user-settings/tokens/UserTokenList.ts
#: src/pages/user-settings/tokens/UserTokenList.ts #: src/pages/user-settings/tokens/UserTokenList.ts
msgid "Create Token" msgid "Create Token"
msgstr "" msgstr ""
@ -2039,6 +2053,11 @@ msgstr ""
msgid "Integrations" msgid "Integrations"
msgstr "" msgstr ""
#: src/pages/tokens/TokenListPage.ts
#: src/pages/user-settings/tokens/UserTokenList.ts
msgid "Intent"
msgstr ""
#: src/pages/providers/proxy/ProxyProviderViewPage.ts #: src/pages/providers/proxy/ProxyProviderViewPage.ts
msgid "Internal Host" msgid "Internal Host"
msgstr "" msgstr ""
@ -3195,6 +3214,7 @@ msgid "Receive a push notification on your phone to prove your identity."
msgstr "" msgstr ""
#: src/pages/flows/FlowForm.ts #: src/pages/flows/FlowForm.ts
#: src/pages/tokens/TokenListPage.ts
#: src/pages/users/UserListPage.ts #: src/pages/users/UserListPage.ts
msgid "Recovery" msgid "Recovery"
msgstr "" msgstr ""
@ -4373,10 +4393,13 @@ msgstr ""
#: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts #: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts
#: src/interfaces/AdminInterface.ts #: src/interfaces/AdminInterface.ts
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts
#: src/pages/user-settings/UserSettingsPage.ts
msgid "Tokens" msgid "Tokens"
msgstr "" msgstr ""
#: src/pages/user-settings/UserSettingsPage.ts
msgid "Tokens and App passwords"
msgstr ""
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts
msgid "Tokens are used throughout authentik for Email validation stages, Recovery keys and API access." msgid "Tokens are used throughout authentik for Email validation stages, Recovery keys and API access."
msgstr "" msgstr ""
@ -4844,6 +4867,10 @@ msgstr ""
msgid "Validity days" msgid "Validity days"
msgstr "" msgstr ""
#: src/pages/tokens/TokenListPage.ts
msgid "Verification"
msgstr ""
#: src/pages/providers/saml/SAMLProviderForm.ts #: src/pages/providers/saml/SAMLProviderForm.ts
msgid "Verification Certificate" msgid "Verification Certificate"
msgstr "" msgstr ""

View File

@ -8,9 +8,22 @@ import "../../elements/buttons/TokenCopyButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
import { TableColumn } from "../../elements/table/Table"; import { TableColumn } from "../../elements/table/Table";
import { PAGE_SIZE } from "../../constants"; import { PAGE_SIZE } from "../../constants";
import { CoreApi, Token } from "@goauthentik/api"; import { CoreApi, IntentEnum, Token } from "@goauthentik/api";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
export function IntentToLabel(intent: IntentEnum): string {
switch (intent) {
case IntentEnum.Api:
return t`API Access`;
case IntentEnum.AppPassword:
return t`App password`;
case IntentEnum.Recovery:
return t`Recovery`;
case IntentEnum.Verification:
return t`Verification`;
}
}
@customElement("ak-token-list") @customElement("ak-token-list")
export class TokenListPage extends TablePage<Token> { export class TokenListPage extends TablePage<Token> {
searchEnabled(): boolean { searchEnabled(): boolean {
@ -46,6 +59,7 @@ export class TokenListPage extends TablePage<Token> {
new TableColumn(t`User`, "user"), new TableColumn(t`User`, "user"),
new TableColumn(t`Expires?`, "expiring"), new TableColumn(t`Expires?`, "expiring"),
new TableColumn(t`Expiry date`, "expires"), new TableColumn(t`Expiry date`, "expires"),
new TableColumn(t`Intent`, "intent"),
new TableColumn(t`Actions`), new TableColumn(t`Actions`),
]; ];
} }
@ -78,6 +92,7 @@ export class TokenListPage extends TablePage<Token> {
html`${item.user?.username}`, html`${item.user?.username}`,
html`${item.expiring ? t`Yes` : t`No`}`, html`${item.expiring ? t`Yes` : t`No`}`,
html`${item.expiring ? item.expires?.toLocaleString() : "-"}`, html`${item.expiring ? item.expires?.toLocaleString() : "-"}`,
html`${IntentToLabel(item.intent || IntentEnum.Api)}`,
html` html`
<ak-token-copy-button identifier="${item.identifier}"> <ak-token-copy-button identifier="${item.identifier}">
${t`Copy Key`} ${t`Copy Key`}

View File

@ -13,6 +13,7 @@ import { PAGE_SIZE } from "../../../constants";
import { CoreApi, IntentEnum, Token } from "@goauthentik/api"; import { CoreApi, IntentEnum, Token } from "@goauthentik/api";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
import "./UserTokenForm"; import "./UserTokenForm";
import { IntentToLabel } from "../../tokens/TokenListPage";
@customElement("ak-user-token-list") @customElement("ak-user-token-list")
export class UserTokenList extends Table<Token> { export class UserTokenList extends Table<Token> {
@ -100,6 +101,16 @@ export class UserTokenList extends Table<Token> {
</div> </div>
</dd> </dd>
</div> </div>
<div class="pf-c-description-list__group">
<dt class="pf-c-description-list__term">
<span class="pf-c-description-list__text">${t`Intent`}</span>
</dt>
<dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text">
${IntentToLabel(item.intent || IntentEnum.Api)}
</div>
</dd>
</div>
</dl> </dl>
</div> </div>
</td> </td>