mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-18 00:19:49 +01:00
feat: Make SAML dialog aware that it might be configured via env (#7606)
Same as the OIDC changes we merged yesterday, this makes the frontend ready for disabling SAML configuration page, if the SAML_ environment variables are set. --------- Co-authored-by: Nuno Góis <github@nunogois.com>
This commit is contained in:
parent
949a5f0109
commit
d397819fd3
@ -113,8 +113,8 @@ export const OidcAuth = () => {
|
|||||||
condition={Boolean(oidcConfiguredThroughEnv)}
|
condition={Boolean(oidcConfiguredThroughEnv)}
|
||||||
show={
|
show={
|
||||||
<Alert sx={{ mb: 2 }} severity='warning'>
|
<Alert sx={{ mb: 2 }} severity='warning'>
|
||||||
OIDC setup is currently controlled via
|
OIDC is currently configured via environment
|
||||||
environment variables. Please see the{' '}
|
variables. Please refer to the{' '}
|
||||||
<a
|
<a
|
||||||
href='https://www.unleash-hosted.com/docs/enterprise-authentication'
|
href='https://www.unleash-hosted.com/docs/enterprise-authentication'
|
||||||
target='_blank'
|
target='_blank'
|
||||||
@ -122,8 +122,8 @@ export const OidcAuth = () => {
|
|||||||
>
|
>
|
||||||
documentation
|
documentation
|
||||||
</a>{' '}
|
</a>{' '}
|
||||||
to learn how to set the correct environment
|
for detailed instructions on how to set up OIDC
|
||||||
variables
|
using these variables.
|
||||||
</Alert>
|
</Alert>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
@ -17,6 +17,7 @@ import { formatUnknownError } from 'utils/formatUnknownError';
|
|||||||
import { removeEmptyStringFields } from 'utils/removeEmptyStringFields';
|
import { removeEmptyStringFields } from 'utils/removeEmptyStringFields';
|
||||||
import { SsoGroupSettings } from '../SsoGroupSettings';
|
import { SsoGroupSettings } from '../SsoGroupSettings';
|
||||||
import type { IRole } from 'interfaces/role';
|
import type { IRole } from 'interfaces/role';
|
||||||
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@ -40,6 +41,7 @@ type State = typeof initialState & {
|
|||||||
export const SamlAuth = () => {
|
export const SamlAuth = () => {
|
||||||
const { setToastData, setToastApiError } = useToast();
|
const { setToastData, setToastApiError } = useToast();
|
||||||
const { uiConfig } = useUiConfig();
|
const { uiConfig } = useUiConfig();
|
||||||
|
const { samlConfiguredThroughEnv } = uiConfig;
|
||||||
const [data, setData] = useState<State>(initialState);
|
const [data, setData] = useState<State>(initialState);
|
||||||
const { config } = useAuthSettings('saml');
|
const { config } = useAuthSettings('saml');
|
||||||
const { updateSettings, errors, loading } = useAuthSettingsApi('saml');
|
const { updateSettings, errors, loading } = useAuthSettingsApi('saml');
|
||||||
@ -98,6 +100,24 @@ export const SamlAuth = () => {
|
|||||||
<>
|
<>
|
||||||
<Grid container sx={{ mb: 3 }}>
|
<Grid container sx={{ mb: 3 }}>
|
||||||
<Grid item md={12}>
|
<Grid item md={12}>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={Boolean(samlConfiguredThroughEnv)}
|
||||||
|
show={
|
||||||
|
<Alert sx={{ mb: 2 }} severity='warning'>
|
||||||
|
SAML is currently configured via environment
|
||||||
|
variables. Please refer to the{' '}
|
||||||
|
<a
|
||||||
|
href='https://www.unleash-hosted.com/docs/enterprise-authentication'
|
||||||
|
target='_blank'
|
||||||
|
rel='noreferrer'
|
||||||
|
>
|
||||||
|
documentation
|
||||||
|
</a>{' '}
|
||||||
|
for detailed instructions on how to set up SAML
|
||||||
|
using these variables.
|
||||||
|
</Alert>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<Alert severity='info'>
|
<Alert severity='info'>
|
||||||
Please read the{' '}
|
Please read the{' '}
|
||||||
<a
|
<a
|
||||||
@ -128,6 +148,7 @@ export const SamlAuth = () => {
|
|||||||
value={data.enabled}
|
value={data.enabled}
|
||||||
name='enabled'
|
name='enabled'
|
||||||
checked={data.enabled}
|
checked={data.enabled}
|
||||||
|
disabled={samlConfiguredThroughEnv}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
label={data.enabled ? 'Enabled' : 'Disabled'}
|
label={data.enabled ? 'Enabled' : 'Disabled'}
|
||||||
@ -145,7 +166,7 @@ export const SamlAuth = () => {
|
|||||||
label='Entity ID'
|
label='Entity ID'
|
||||||
name='entityId'
|
name='entityId'
|
||||||
value={data.entityId}
|
value={data.entityId}
|
||||||
disabled={!data.enabled}
|
disabled={!data.enabled || samlConfiguredThroughEnv}
|
||||||
style={{ width: '400px' }}
|
style={{ width: '400px' }}
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
size='small'
|
size='small'
|
||||||
@ -167,7 +188,7 @@ export const SamlAuth = () => {
|
|||||||
label='Single Sign-On URL'
|
label='Single Sign-On URL'
|
||||||
name='signOnUrl'
|
name='signOnUrl'
|
||||||
value={data.signOnUrl}
|
value={data.signOnUrl}
|
||||||
disabled={!data.enabled}
|
disabled={!data.enabled || samlConfiguredThroughEnv}
|
||||||
style={{ width: '400px' }}
|
style={{ width: '400px' }}
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
size='small'
|
size='small'
|
||||||
@ -189,7 +210,7 @@ export const SamlAuth = () => {
|
|||||||
label='X.509 Certificate'
|
label='X.509 Certificate'
|
||||||
name='certificate'
|
name='certificate'
|
||||||
value={data.certificate}
|
value={data.certificate}
|
||||||
disabled={!data.enabled}
|
disabled={!data.enabled || samlConfiguredThroughEnv}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
style: {
|
style: {
|
||||||
@ -221,7 +242,7 @@ export const SamlAuth = () => {
|
|||||||
label='Single Sign-out URL'
|
label='Single Sign-out URL'
|
||||||
name='signOutUrl'
|
name='signOutUrl'
|
||||||
value={data.signOutUrl}
|
value={data.signOutUrl}
|
||||||
disabled={!data.enabled}
|
disabled={!data.enabled || samlConfiguredThroughEnv}
|
||||||
style={{ width: '400px' }}
|
style={{ width: '400px' }}
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
size='small'
|
size='small'
|
||||||
@ -244,7 +265,7 @@ export const SamlAuth = () => {
|
|||||||
label='X.509 Certificate'
|
label='X.509 Certificate'
|
||||||
name='spCertificate'
|
name='spCertificate'
|
||||||
value={data.spCertificate}
|
value={data.spCertificate}
|
||||||
disabled={!data.enabled}
|
disabled={!data.enabled || samlConfiguredThroughEnv}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
style: {
|
style: {
|
||||||
@ -265,12 +286,14 @@ export const SamlAuth = () => {
|
|||||||
ssoType='SAML'
|
ssoType='SAML'
|
||||||
data={data}
|
data={data}
|
||||||
setValue={setValue}
|
setValue={setValue}
|
||||||
|
disabled={samlConfiguredThroughEnv}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<AutoCreateForm
|
<AutoCreateForm
|
||||||
data={data}
|
data={data}
|
||||||
setValue={setValue}
|
setValue={setValue}
|
||||||
onUpdateRole={onUpdateRole}
|
onUpdateRole={onUpdateRole}
|
||||||
|
disabled={samlConfiguredThroughEnv}
|
||||||
/>
|
/>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
<Grid item md={5}>
|
<Grid item md={5}>
|
||||||
@ -278,7 +301,7 @@ export const SamlAuth = () => {
|
|||||||
variant='contained'
|
variant='contained'
|
||||||
color='primary'
|
color='primary'
|
||||||
type='submit'
|
type='submit'
|
||||||
disabled={loading}
|
disabled={loading || samlConfiguredThroughEnv}
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>{' '}
|
</Button>{' '}
|
||||||
|
@ -31,6 +31,7 @@ export interface IUiConfig {
|
|||||||
frontendApiOrigins?: string[];
|
frontendApiOrigins?: string[];
|
||||||
resourceLimits: ResourceLimitsSchema;
|
resourceLimits: ResourceLimitsSchema;
|
||||||
oidcConfiguredThroughEnv?: boolean;
|
oidcConfiguredThroughEnv?: boolean;
|
||||||
|
samlConfiguredThroughEnv?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProclamationToast {
|
export interface IProclamationToast {
|
||||||
|
Loading…
Reference in New Issue
Block a user