-
This commit is contained in:
@ -67,6 +67,7 @@ const Applications: React.FC = () => {
|
||||
app_link: app.app_link,
|
||||
type: app.type,
|
||||
callback_url: app.callback_url,
|
||||
token_prefix: app.token_prefix,
|
||||
token_renewal_duration: formatDuration(app.token_renewal_duration),
|
||||
max_token_duration: formatDuration(app.max_token_duration),
|
||||
owner_type: app.owner.type,
|
||||
@ -94,6 +95,7 @@ const Applications: React.FC = () => {
|
||||
app_link: values.app_link,
|
||||
type: values.type,
|
||||
callback_url: values.callback_url,
|
||||
token_prefix: values.token_prefix,
|
||||
token_renewal_duration: values.token_renewal_duration,
|
||||
max_token_duration: values.max_token_duration,
|
||||
owner: {
|
||||
@ -165,6 +167,12 @@ const Applications: React.FC = () => {
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Token Prefix',
|
||||
dataIndex: 'token_prefix',
|
||||
key: 'token_prefix',
|
||||
render: (prefix: string) => prefix ? <Text code>{prefix}</Text> : <Text type="secondary">Default</Text>,
|
||||
},
|
||||
{
|
||||
title: 'Owner',
|
||||
dataIndex: 'owner',
|
||||
@ -307,6 +315,28 @@ const Applications: React.FC = () => {
|
||||
<Input placeholder="https://example.com/callback" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="token_prefix"
|
||||
label="Token Prefix"
|
||||
rules={[
|
||||
{
|
||||
pattern: /^[A-Z]{2,4}$/,
|
||||
message: 'Token prefix must be 2-4 uppercase letters (e.g., NC for Nerd Completion)'
|
||||
},
|
||||
]}
|
||||
help="Optional custom prefix for tokens. Leave empty for default 'kms_' prefix. Examples: NC → NCT- (static), NCUT- (user)"
|
||||
>
|
||||
<Input
|
||||
placeholder="NC"
|
||||
maxLength={4}
|
||||
style={{ textTransform: 'uppercase' }}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value.toUpperCase();
|
||||
form.setFieldValue('token_prefix', value);
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Row gutter={16}>
|
||||
<Col span={12}>
|
||||
<Form.Item
|
||||
@ -432,11 +462,26 @@ const Applications: React.FC = () => {
|
||||
</div>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Text strong>Token Renewal Duration:</Text>
|
||||
<div>{formatDuration(selectedApp.token_renewal_duration)}</div>
|
||||
<Text strong>Token Prefix:</Text>
|
||||
<div>
|
||||
{selectedApp.token_prefix ? (
|
||||
<>
|
||||
<Text code>{selectedApp.token_prefix}</Text>
|
||||
<Text type="secondary" style={{ marginLeft: 8 }}>
|
||||
(Static: {selectedApp.token_prefix}T-, User: {selectedApp.token_prefix}UT-)
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
<Text type="secondary">Default (kms_)</Text>
|
||||
)}
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={16} style={{ marginTop: '16px' }}>
|
||||
<Col span={12}>
|
||||
<Text strong>Token Renewal Duration:</Text>
|
||||
<div>{formatDuration(selectedApp.token_renewal_duration)}</div>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Text strong>Max Token Duration:</Text>
|
||||
<div>{formatDuration(selectedApp.max_token_duration)}</div>
|
||||
|
||||
@ -7,6 +7,7 @@ export interface Application {
|
||||
type: string[];
|
||||
callback_url: string;
|
||||
hmac_key: string;
|
||||
token_prefix?: string;
|
||||
token_renewal_duration: number;
|
||||
max_token_duration: number;
|
||||
owner: {
|
||||
@ -36,6 +37,7 @@ export interface CreateApplicationRequest {
|
||||
app_link: string;
|
||||
type: string[];
|
||||
callback_url: string;
|
||||
token_prefix?: string;
|
||||
token_renewal_duration: string;
|
||||
max_token_duration: string;
|
||||
owner: {
|
||||
|
||||
Reference in New Issue
Block a user