Save the certificate to db
This commit is contained in:
parent
dc9b150304
commit
7919ef8fcc
18
README.md
18
README.md
@ -1,17 +1,7 @@
|
||||
# Backlog
|
||||
|
||||
- Form validation
|
||||
- Feed some users
|
||||
- Fix the download metadata
|
||||
- Add the SAML response
|
||||
- Fix the SAML metadata URL
|
||||
- Improve the UI
|
||||
|
||||
https://github.com/prisma/prisma/issues/4571#issuecomment-747496127
|
||||
# Mock SAML from BoxyHQ
|
||||
|
||||
http://localhost:4000/apps/saml?RelayState&SAMLRequest=
|
||||
|
||||
## Pages
|
||||
- Create an app
|
||||
- List all app
|
||||
- View individual app page (with Download Metadata button and Delete button)
|
||||
- Parse the SAML Request
|
||||
- Create the SAML Response
|
||||
- Fix the certificate
|
||||
@ -1,6 +1,7 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import type { App, IdPMetadata } from '../../../types';
|
||||
import prisma from '../../../lib/prisma';
|
||||
import { createCertificate, createIdPMetadataXML } from '../../../utils';
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
@ -32,12 +33,15 @@ export default async function handler(
|
||||
description = null,
|
||||
} = req.body;
|
||||
|
||||
const certificate = await createCertificate();
|
||||
|
||||
const app = await prisma.app.create({
|
||||
data: {
|
||||
name,
|
||||
acs_url,
|
||||
entity_id,
|
||||
description
|
||||
description,
|
||||
certificate,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import axios from 'axios';
|
||||
import type { NextPage } from 'next';
|
||||
import { ChangeEvent, FormEvent, useState } from 'react';
|
||||
import Router from 'next/router';
|
||||
|
||||
const Apps: NextPage = () => {
|
||||
const [formData, setFormData] = useState({
|
||||
@ -9,12 +10,6 @@ const Apps: NextPage = () => {
|
||||
entity_id: null,
|
||||
});
|
||||
|
||||
const [metadata, setMetadata] = useState({
|
||||
sso_url: null,
|
||||
entity_id: null,
|
||||
certificate: null,
|
||||
});
|
||||
|
||||
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
setFormData({
|
||||
...formData,
|
||||
@ -25,11 +20,11 @@ const Apps: NextPage = () => {
|
||||
const createApp = async (e: FormEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
const {data} = await axios.post('/api/apps', {
|
||||
const { data: app } = await axios.post('/api/apps', {
|
||||
...formData
|
||||
});
|
||||
|
||||
setMetadata(data);
|
||||
await Router.push(`/apps/${app.id}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user