mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-27 00:19:39 +01:00
chore: new hosted auth handler (#9045)
https://linear.app/unleash/issue/2-3074/add-sign-in-with-google-to-our-hosted-instances-when-only-password-is https://linear.app/unleash/issue/2-3078/allow-viewer-access-from-auth-app-for-payg Adds support for a new unified hosted auth handler. This new auth handler provides a Google sign in option in case you don't have an SSO provider configured. It also provides a way for auth-app to sign in with Unleash's read-only user for Pro and Enterprise PAYG instances. Check the PR comments for more details.
This commit is contained in:
parent
608a3986af
commit
e7269473f3
@ -1,4 +1,4 @@
|
|||||||
import { Alert, Tab, Tabs } from '@mui/material';
|
import { Tab, Tabs } from '@mui/material';
|
||||||
import { PageContent } from 'component/common/PageContent/PageContent';
|
import { PageContent } from 'component/common/PageContent/PageContent';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
@ -15,7 +15,6 @@ import { TabPanel } from 'component/common/TabNav/TabPanel/TabPanel';
|
|||||||
import { usePageTitle } from 'hooks/usePageTitle';
|
import { usePageTitle } from 'hooks/usePageTitle';
|
||||||
|
|
||||||
export const AuthSettings = () => {
|
export const AuthSettings = () => {
|
||||||
const { authenticationType } = useUiConfig().uiConfig;
|
|
||||||
const { uiConfig, isEnterprise } = useUiConfig();
|
const { uiConfig, isEnterprise } = useUiConfig();
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
@ -35,17 +34,14 @@ export const AuthSettings = () => {
|
|||||||
label: 'Google',
|
label: 'Google',
|
||||||
component: <GoogleAuth />,
|
component: <GoogleAuth />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'SCIM',
|
||||||
|
component: <ScimSettings />,
|
||||||
|
},
|
||||||
].filter(
|
].filter(
|
||||||
(item) => uiConfig.flags?.googleAuthEnabled || item.label !== 'Google',
|
(item) => uiConfig.flags?.googleAuthEnabled || item.label !== 'Google',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isEnterprise()) {
|
|
||||||
tabs.push({
|
|
||||||
label: 'SCIM',
|
|
||||||
component: <ScimSettings />,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState(0);
|
const [activeTab, setActiveTab] = useState(0);
|
||||||
usePageTitle(`Single sign-on: ${tabs[activeTab].label}`);
|
usePageTitle(`Single sign-on: ${tabs[activeTab].label}`);
|
||||||
|
|
||||||
@ -56,7 +52,7 @@ export const AuthSettings = () => {
|
|||||||
withTabs
|
withTabs
|
||||||
header={
|
header={
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={authenticationType === 'enterprise'}
|
condition={isEnterprise()}
|
||||||
show={
|
show={
|
||||||
<Tabs
|
<Tabs
|
||||||
value={activeTab}
|
value={activeTab}
|
||||||
@ -85,41 +81,7 @@ export const AuthSettings = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={authenticationType === 'open-source'}
|
condition={isEnterprise()}
|
||||||
show={<PremiumFeature feature='sso' />}
|
|
||||||
/>
|
|
||||||
<ConditionallyRender
|
|
||||||
condition={authenticationType === 'demo'}
|
|
||||||
show={
|
|
||||||
<Alert severity='warning'>
|
|
||||||
You are running Unleash in demo mode. You have
|
|
||||||
to use the Enterprise edition in order configure
|
|
||||||
Single Sign-on.
|
|
||||||
</Alert>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<ConditionallyRender
|
|
||||||
condition={authenticationType === 'custom'}
|
|
||||||
show={
|
|
||||||
<Alert severity='warning'>
|
|
||||||
You have decided to use custom authentication
|
|
||||||
type. You have to use the Enterprise edition in
|
|
||||||
order configure Single Sign-on from the user
|
|
||||||
interface.
|
|
||||||
</Alert>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<ConditionallyRender
|
|
||||||
condition={authenticationType === 'hosted'}
|
|
||||||
show={
|
|
||||||
<Alert severity='info'>
|
|
||||||
Your Unleash instance is managed by the Unleash
|
|
||||||
team.
|
|
||||||
</Alert>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<ConditionallyRender
|
|
||||||
condition={authenticationType === 'enterprise'}
|
|
||||||
show={
|
show={
|
||||||
<div>
|
<div>
|
||||||
{tabs.map((tab, index) => (
|
{tabs.map((tab, index) => (
|
||||||
@ -133,6 +95,7 @@ export const AuthSettings = () => {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
elseShow={<PremiumFeature feature='sso' />}
|
||||||
/>
|
/>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
</PermissionGuard>
|
</PermissionGuard>
|
||||||
|
@ -61,7 +61,8 @@ export type IFlagKey =
|
|||||||
| 'streaming'
|
| 'streaming'
|
||||||
| 'etagVariant'
|
| 'etagVariant'
|
||||||
| 'oidcRedirect'
|
| 'oidcRedirect'
|
||||||
| 'deltaApi';
|
| 'deltaApi'
|
||||||
|
| 'newHostedAuthHandler';
|
||||||
|
|
||||||
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
|
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
|
||||||
|
|
||||||
@ -290,6 +291,10 @@ const flags: IFlags = {
|
|||||||
process.env.UNLEASH_EXPERIMENTAL_DELTA_API,
|
process.env.UNLEASH_EXPERIMENTAL_DELTA_API,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
|
newHostedAuthHandler: parseEnvVarBoolean(
|
||||||
|
process.env.UNLEASH_EXPERIMENTAL_NEW_HOSTED_AUTH_HANDLER,
|
||||||
|
false,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const defaultExperimentalOptions: IExperimentalOptions = {
|
export const defaultExperimentalOptions: IExperimentalOptions = {
|
||||||
|
@ -54,7 +54,13 @@ export interface IVersionOption {
|
|||||||
export enum IAuthType {
|
export enum IAuthType {
|
||||||
OPEN_SOURCE = 'open-source',
|
OPEN_SOURCE = 'open-source',
|
||||||
DEMO = 'demo',
|
DEMO = 'demo',
|
||||||
|
/**
|
||||||
|
* Self-hosted by the customer. Should eventually be renamed to better reflect this.
|
||||||
|
*/
|
||||||
ENTERPRISE = 'enterprise',
|
ENTERPRISE = 'enterprise',
|
||||||
|
/**
|
||||||
|
* Hosted by Unleash.
|
||||||
|
*/
|
||||||
HOSTED = 'hosted',
|
HOSTED = 'hosted',
|
||||||
CUSTOM = 'custom',
|
CUSTOM = 'custom',
|
||||||
NONE = 'none',
|
NONE = 'none',
|
||||||
|
Loading…
Reference in New Issue
Block a user