fix: addressed requested changes

This commit is contained in:
Daniel Hougaard
2025-05-08 23:13:46 +04:00
parent a4b648ad95
commit a3b7df4e6b
12 changed files with 166 additions and 146 deletions
@@ -1064,7 +1064,6 @@ export const useAddIdentityLdapAuth = () => {
bindPass,
searchBase,
searchFilter,
uniqueAttribute,
ldapCaCertificate,
allowedFields,
accessTokenTTL,
@@ -1080,7 +1079,6 @@ export const useAddIdentityLdapAuth = () => {
bindPass,
searchBase,
searchFilter,
uniqueAttribute,
ldapCaCertificate,
allowedFields,
accessTokenTTL,
@@ -1113,7 +1111,6 @@ export const useUpdateIdentityLdapAuth = () => {
bindPass,
searchBase,
searchFilter,
uniqueAttribute,
ldapCaCertificate,
allowedFields,
accessTokenTTL,
@@ -1129,7 +1126,6 @@ export const useUpdateIdentityLdapAuth = () => {
bindPass,
searchBase,
searchFilter,
uniqueAttribute,
ldapCaCertificate,
allowedFields,
accessTokenTTL,
@@ -433,7 +433,6 @@ export type AddIdentityLdapAuthDTO = {
bindPass: string;
searchBase: string;
searchFilter: string;
uniqueAttribute: string;
ldapCaCertificate?: string;
allowedFields?: {
key: string;
@@ -455,7 +454,6 @@ export type UpdateIdentityLdapAuthDTO = {
bindPass?: string;
searchBase?: string;
searchFilter?: string;
uniqueAttribute?: string;
ldapCaCertificate?: string;
allowedFields?: {
key: string;
@@ -480,7 +478,6 @@ export type IdentityLdapAuth = {
bindPass: string;
searchBase: string;
searchFilter: string;
uniqueAttribute: string;
ldapCaCertificate?: string;
allowedFields?: {
key: string;
@@ -35,7 +35,6 @@ const schema = z
bindDN: z.string(),
bindPass: z.string(),
searchBase: z.string(),
uniqueAttribute: z.string(), // defaults to uidNumber
searchFilter: z.string(), // defaults to (uid={{username}})
ldapCaCertificate: z
.string()
@@ -112,7 +111,6 @@ export const IdentityLdapAuthForm = ({
bindDN: "",
bindPass: "",
searchBase: "",
uniqueAttribute: "uidNumber",
searchFilter: "(uid={{username}})",
accessTokenTTL: "2592000",
accessTokenMaxTTL: "2592000",
@@ -140,7 +138,6 @@ export const IdentityLdapAuthForm = ({
bindDN: data.bindDN,
bindPass: data.bindPass,
searchBase: data.searchBase,
uniqueAttribute: data.uniqueAttribute,
searchFilter: data.searchFilter,
ldapCaCertificate: data.ldapCaCertificate || undefined,
allowedFields: data.allowedFields,
@@ -161,7 +158,6 @@ export const IdentityLdapAuthForm = ({
bindDN: "",
bindPass: "",
searchBase: "",
uniqueAttribute: "uidNumber",
searchFilter: "(uid={{username}})",
ldapCaCertificate: undefined,
allowedFields: [],
@@ -185,7 +181,6 @@ export const IdentityLdapAuthForm = ({
bindDN,
bindPass,
searchBase,
uniqueAttribute,
searchFilter,
ldapCaCertificate,
allowedFields,
@@ -206,7 +201,6 @@ export const IdentityLdapAuthForm = ({
bindPass,
searchBase,
searchFilter,
uniqueAttribute,
ldapCaCertificate,
allowedFields,
accessTokenTTL: Number(accessTokenTTL),
@@ -223,7 +217,6 @@ export const IdentityLdapAuthForm = ({
bindPass,
searchBase,
searchFilter,
uniqueAttribute,
ldapCaCertificate,
allowedFields,
accessTokenTTL: Number(accessTokenTTL),
@@ -259,8 +252,8 @@ export const IdentityLdapAuthForm = ({
"bindPass",
"searchBase",
"searchFilter",
"uniqueAttribute",
"accessTokenTTL",
"allowedFields",
"accessTokenMaxTTL",
"accessTokenNumUsesLimit"
].includes(Object.keys(fields)[0])
@@ -334,21 +327,6 @@ export const IdentityLdapAuthForm = ({
)}
/>
<Controller
control={control}
name="uniqueAttribute"
render={({ field, fieldState: { error } }) => (
<FormControl
isRequired
label="Unique User Attribute"
isError={Boolean(error)}
errorText={error?.message}
>
<Input {...field} placeholder="uidNumber" />
</FormControl>
)}
/>
<Controller
control={control}
name="searchFilter"
@@ -364,69 +342,6 @@ export const IdentityLdapAuthForm = ({
)}
/>
<Controller
control={control}
defaultValue="2592000"
name="accessTokenTTL"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Access Token TTL (seconds)"
tooltipText="The lifetime for an acccess token in seconds. This value will be referenced at renewal time."
isError={Boolean(error)}
errorText={error?.message}
>
<Input {...field} placeholder="2592000" type="number" min="0" step="1" />
</FormControl>
)}
/>
<Controller
control={control}
defaultValue="2592000"
name="accessTokenMaxTTL"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Access Token Max TTL (seconds)"
isError={Boolean(error)}
errorText={error?.message}
tooltipText="The maximum lifetime for an access token in seconds. This value will be referenced at renewal time."
>
<Input {...field} placeholder="2592000" type="number" min="0" step="1" />
</FormControl>
)}
/>
<Controller
control={control}
defaultValue="0"
name="accessTokenNumUsesLimit"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Access Token Max Number of Uses"
isError={Boolean(error)}
errorText={error?.message}
tooltipText="The maximum number of times that an access token can be used; a value of 0 implies infinite number of uses."
>
<Input {...field} placeholder="0" type="number" min="0" step="1" />
</FormControl>
)}
/>
</TabPanel>
<TabPanel value={IdentityFormTab.Advanced}>
<Controller
control={control}
name="ldapCaCertificate"
render={({ field, fieldState: { error } }) => (
<FormControl
label="CA Certificate"
isOptional
errorText={error?.message}
isError={Boolean(error)}
tooltipText="An optional PEM-encoded CA cert for the LDAP server. This is used by the TLS client for secure communication with the LDAP server."
>
<TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />
</FormControl>
)}
/>
{allowedFieldsFields.map(({ id }, index) => (
<div className="mb-3 flex items-end space-x-2" key={id}>
<Controller
@@ -535,6 +450,69 @@ export const IdentityLdapAuthForm = ({
</Button>
</div>
<Controller
control={control}
defaultValue="2592000"
name="accessTokenTTL"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Access Token TTL (seconds)"
tooltipText="The lifetime for an acccess token in seconds. This value will be referenced at renewal time."
isError={Boolean(error)}
errorText={error?.message}
>
<Input {...field} placeholder="2592000" type="number" min="0" step="1" />
</FormControl>
)}
/>
<Controller
control={control}
defaultValue="2592000"
name="accessTokenMaxTTL"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Access Token Max TTL (seconds)"
isError={Boolean(error)}
errorText={error?.message}
tooltipText="The maximum lifetime for an access token in seconds. This value will be referenced at renewal time."
>
<Input {...field} placeholder="2592000" type="number" min="0" step="1" />
</FormControl>
)}
/>
<Controller
control={control}
defaultValue="0"
name="accessTokenNumUsesLimit"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Access Token Max Number of Uses"
isError={Boolean(error)}
errorText={error?.message}
tooltipText="The maximum number of times that an access token can be used; a value of 0 implies infinite number of uses."
>
<Input {...field} placeholder="0" type="number" min="0" step="1" />
</FormControl>
)}
/>
</TabPanel>
<TabPanel value={IdentityFormTab.Advanced}>
<Controller
control={control}
name="ldapCaCertificate"
render={({ field, fieldState: { error } }) => (
<FormControl
label="CA Certificate"
isOptional
errorText={error?.message}
isError={Boolean(error)}
tooltipText="An optional PEM-encoded CA cert for the LDAP server. This is used by the TLS client for secure communication with the LDAP server."
>
<TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />
</FormControl>
)}
/>
{accessTokenTrustedIpsFields.map(({ id }, index) => (
<div className="mb-3 flex items-end space-x-2" key={id}>
<Controller
@@ -79,9 +79,6 @@ export const ViewIdentityLdapAuthContent = ({
<IdentityAuthFieldDisplay label="Search Base / DN">
{data.searchBase}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Unique Attribute">
{data.uniqueAttribute}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Search Filter">{data.searchFilter}</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="CA Certificate">
{data.ldapCaCertificate && (