add required domains for apps
This commit is contained in:
parent
d8732d7853
commit
1bd22a8a48
@ -8,6 +8,7 @@ interface App {
|
|||||||
id: string;
|
id: string;
|
||||||
spAcsUrl: string;
|
spAcsUrl: string;
|
||||||
spEntityId: string;
|
spEntityId: string;
|
||||||
|
requiredDomain: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useStore(): [StoreData, (_: StoreData) => void] {
|
export function useStore(): [StoreData, (_: StoreData) => void] {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ export function InstantSetupPage() {
|
|||||||
const appId = searchParams.get("appId")!;
|
const appId = searchParams.get("appId")!;
|
||||||
const spAcsUrl = searchParams.get("spAcsUrl")!;
|
const spAcsUrl = searchParams.get("spAcsUrl")!;
|
||||||
const spEntityId = searchParams.get("spEntityId")!;
|
const spEntityId = searchParams.get("spEntityId")!;
|
||||||
|
const requiredDomain = searchParams.get("requiredDomain")!;
|
||||||
const email = searchParams.get("email")!;
|
const email = searchParams.get("email")!;
|
||||||
const firstName = searchParams.get("firstName")!;
|
const firstName = searchParams.get("firstName")!;
|
||||||
const lastName = searchParams.get("lastName")!;
|
const lastName = searchParams.get("lastName")!;
|
||||||
@ -24,6 +25,7 @@ export function InstantSetupPage() {
|
|||||||
id: appId,
|
id: appId,
|
||||||
spAcsUrl,
|
spAcsUrl,
|
||||||
spEntityId,
|
spEntityId,
|
||||||
|
requiredDomain,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import moment from "moment";
|
|||||||
import { clsx } from "clsx";
|
import { clsx } from "clsx";
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
email: z.string().email({ message: "Email must be a well-formed email." }),
|
email: z.string().min(1, { message: "Email is required." }),
|
||||||
firstName: z.string(),
|
firstName: z.string(),
|
||||||
lastName: z.string(),
|
lastName: z.string(),
|
||||||
});
|
});
|
||||||
@ -98,7 +98,7 @@ export function SSOPage() {
|
|||||||
|
|
||||||
inputRef.current!.value = await encodeAssertion(key, {
|
inputRef.current!.value = await encodeAssertion(key, {
|
||||||
idpEntityId: `https://dummyidp.com/apps/${app.id}`,
|
idpEntityId: `https://dummyidp.com/apps/${app.id}`,
|
||||||
subjectId: values.email,
|
subjectId: `${values.email}@${app.requiredDomain}`,
|
||||||
firstName: values.firstName,
|
firstName: values.firstName,
|
||||||
lastName: values.lastName,
|
lastName: values.lastName,
|
||||||
spEntityId: app.spEntityId,
|
spEntityId: app.spEntityId,
|
||||||
@ -138,20 +138,14 @@ export function SSOPage() {
|
|||||||
<FormItem className="col-span-2">
|
<FormItem className="col-span-2">
|
||||||
<FormLabel>Email</FormLabel>
|
<FormLabel>Email</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input type="email" {...field} />
|
<div className="flex">
|
||||||
|
<Input className="rounded-r-none" {...field} />
|
||||||
|
<span className="inline-flex text-sm items-center rounded-r-md border border-l-0 border-input px-3 text-muted-foreground">
|
||||||
|
@{app.requiredDomain}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
{email && (
|
|
||||||
<FormDescription>
|
|
||||||
You'll want to keep this as a{" "}
|
|
||||||
<span className="font-semibold">
|
|
||||||
{email.split("@")[1]}
|
|
||||||
</span>{" "}
|
|
||||||
email address, otherwise your login will probably be
|
|
||||||
rejected by {new URL(app.spAcsUrl).hostname}.
|
|
||||||
</FormDescription>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user