Skip to content

Commit

Permalink
Merge branch 'main' into identity-fed-routes
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakprabhakara committed Apr 30, 2024
2 parents 0439806 + 886b855 commit e3ead0c
Show file tree
Hide file tree
Showing 20 changed files with 2,679 additions and 2,533 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODEJS_IMAGE=node:20.12.1-alpine3.19
ARG NODEJS_IMAGE=node:20.12.2-alpine3.19
FROM --platform=$BUILDPLATFORM $NODEJS_IMAGE AS base

# Install dependencies only when needed
Expand Down
7 changes: 6 additions & 1 deletion ee/branding/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ const Branding = ({ hasValidLicense }: { hasValidLicense: boolean }) => {
<label className='label'>
<span className='label-text'>{t('bui-shared-primary-color')}</span>
</label>
<input type='color' id='primaryColor' onChange={onChange} value={branding.primaryColor || ''} />
<input
type='color'
id='primaryColor'
onChange={onChange}
value={branding.primaryColor || '#25c2a0'}
/>
<label className='label'>
<span className='label-text-alt'>{t('bui-shared-primary-color-desc')}</span>
</label>
Expand Down
7 changes: 7 additions & 0 deletions ee/identity-federation/api/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { NextApiRequest, NextApiResponse } from 'next';
import jackson from '@lib/jackson';
import { defaultHandler } from '@lib/api';
import { parsePaginateApiParams } from '@lib/utils';
import { validateDevelopmentModeLimits } from '@lib/development-mode';

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
await defaultHandler(req, res, {
Expand All @@ -15,6 +16,12 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => {
const { samlFederatedController } = await jackson();

await validateDevelopmentModeLimits(
req.body.product,
'samlFederation',
'Maximum number of federation apps reached'
);

const app = await samlFederatedController.app.create(req.body);

res.status(201).json({ data: app });
Expand Down
36 changes: 14 additions & 22 deletions ee/identity-federation/api/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,28 @@ import { AppRequestParams } from '@boxyhq/saml-jackson';
import { NextApiRequest, NextApiResponse } from 'next';

import jackson from '@lib/jackson';
import { validateDevelopmentModeLimits } from '@lib/development-mode';
import { defaultHandler } from '@lib/api';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
switch (req.method) {
case 'POST':
await handlePOST(req, res);
break;
case 'GET':
await handleGET(req, res);
break;
case 'PATCH':
await handlePATCH(req, res);
break;
case 'DELETE':
await handleDELETE(req, res);
break;
default:
res.setHeader('Allow', 'POST, GET, PATCH, DELETE');
res.status(405).json({ error: { message: `Method ${req.method} Not Allowed` } });
}
} catch (error: any) {
const { message, statusCode = 500 } = error;
res.status(statusCode).json({ error: { message } });
}
await defaultHandler(req, res, {
POST: handlePOST,
GET: handleGET,
PATCH: handlePATCH,
DELETE: handleDELETE,
});
}

// Create a SAML federated app
const handlePOST = async (req: NextApiRequest, res: NextApiResponse) => {
const { samlFederatedController } = await jackson();

await validateDevelopmentModeLimits(
req.body.product,
'samlFederation',
'Maximum number of federation apps reached'
);

const app = await samlFederatedController.app.create(req.body);

res.status(201).json({ data: app });
Expand Down
Loading

0 comments on commit e3ead0c

Please sign in to comment.