mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 05:26:25 +00:00
feat(folder-scoped-st): implemented frontend ui for folder scoped service token
This commit is contained in:
@@ -3,6 +3,7 @@ export type ServiceToken = {
|
|||||||
name: string;
|
name: string;
|
||||||
workspace: string;
|
workspace: string;
|
||||||
environment: string;
|
environment: string;
|
||||||
|
secretPath: string;
|
||||||
user: string;
|
user: string;
|
||||||
expiresAt: string;
|
expiresAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
@@ -15,6 +16,7 @@ export type CreateServiceTokenDTO = {
|
|||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
environment: string;
|
environment: string;
|
||||||
expiresIn: number;
|
expiresIn: number;
|
||||||
|
secretPath: string;
|
||||||
encryptedKey: string;
|
encryptedKey: string;
|
||||||
iv: string;
|
iv: string;
|
||||||
tag: string;
|
tag: string;
|
||||||
|
|||||||
@@ -219,7 +219,8 @@ export const ProjectSettingsPage = () => {
|
|||||||
environment,
|
environment,
|
||||||
expiresIn,
|
expiresIn,
|
||||||
name,
|
name,
|
||||||
permissions
|
permissions,
|
||||||
|
secretPath
|
||||||
}: CreateServiceToken) => {
|
}: CreateServiceToken) => {
|
||||||
// type guard
|
// type guard
|
||||||
if (!latestFileKey) return '';
|
if (!latestFileKey) return '';
|
||||||
@@ -243,6 +244,7 @@ export const ProjectSettingsPage = () => {
|
|||||||
iv,
|
iv,
|
||||||
tag,
|
tag,
|
||||||
environment,
|
environment,
|
||||||
|
secretPath,
|
||||||
expiresIn: Number(expiresIn),
|
expiresIn: Number(expiresIn),
|
||||||
name,
|
name,
|
||||||
workspaceId: workspaceID,
|
workspaceId: workspaceID,
|
||||||
|
|||||||
+21
-2
@@ -42,8 +42,9 @@ const apiTokenExpiry = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const createServiceTokenSchema = yup.object({
|
const createServiceTokenSchema = yup.object({
|
||||||
name: yup.string().required().label('Service Token Name'),
|
name: yup.string().max(100).required().label('Service Token Name'),
|
||||||
environment: yup.string().required().label('Environment'),
|
environment: yup.string().max(50).required().label('Environment'),
|
||||||
|
secretPath: yup.string().required().default('/').label('Secret Path'),
|
||||||
expiresIn: yup.string().optional().label('Service Token Expiration'),
|
expiresIn: yup.string().optional().label('Service Token Expiration'),
|
||||||
permissions: yup
|
permissions: yup
|
||||||
.object()
|
.object()
|
||||||
@@ -201,6 +202,22 @@ export const ServiceTokenSection = ({
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="secretPath"
|
||||||
|
defaultValue="/"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="Secrets Path"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
helperText="Tokens can be scoped to a folder path. Default path is /"
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input {...field} placeholder="Provide a path, default is /" />
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="expiresIn"
|
name="expiresIn"
|
||||||
@@ -329,6 +346,7 @@ export const ServiceTokenSection = ({
|
|||||||
<Tr>
|
<Tr>
|
||||||
<Th>Token Name</Th>
|
<Th>Token Name</Th>
|
||||||
<Th>Environment</Th>
|
<Th>Environment</Th>
|
||||||
|
<Th>Secret Path</Th>
|
||||||
<Th>Valid Until</Th>
|
<Th>Valid Until</Th>
|
||||||
<Th aria-label="button" />
|
<Th aria-label="button" />
|
||||||
</Tr>
|
</Tr>
|
||||||
@@ -340,6 +358,7 @@ export const ServiceTokenSection = ({
|
|||||||
<Tr key={row._id}>
|
<Tr key={row._id}>
|
||||||
<Td>{row.name}</Td>
|
<Td>{row.name}</Td>
|
||||||
<Td>{row.environment}</Td>
|
<Td>{row.environment}</Td>
|
||||||
|
<Td>{row.secretPath}</Td>
|
||||||
<Td>{row.expiresAt && new Date(row.expiresAt).toUTCString()}</Td>
|
<Td>{row.expiresAt && new Date(row.expiresAt).toUTCString()}</Td>
|
||||||
<Td className="flex items-center justify-end">
|
<Td className="flex items-center justify-end">
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|||||||
Reference in New Issue
Block a user