mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
The product is branded Hanzo eSign (esign.hanzo.ai, repo hanzoai/esign). Rename all workspace packages @hanzo/sign-* → @hanzo/esign-* (1052 files) and align docker/Dockerfile turbo --scope/--filter to the actual remix package name @hanzo/esign (was a pre-existing mismatch with -remix that broke the build). Protected deps (@hanzo/insights, @hanzo/logo) untouched.
60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
import { NEXT_PUBLIC_WEBAPP_URL } from '@hanzo/esign-lib/constants/app';
|
|
import { env } from '@hanzo/esign-lib/utils/env';
|
|
|
|
/**
|
|
* How long a session should live for in milliseconds.
|
|
*/
|
|
export const AUTH_SESSION_LIFETIME = 1000 * 60 * 60 * 24 * 30; // 30 days.
|
|
|
|
export type OAuthClientOptions = {
|
|
id: string;
|
|
scope: string[];
|
|
clientId: string;
|
|
clientSecret: string;
|
|
wellKnownUrl: string;
|
|
redirectUrl: string;
|
|
bypassEmailVerification?: boolean;
|
|
};
|
|
|
|
export const GoogleAuthOptions: OAuthClientOptions = {
|
|
id: 'google',
|
|
scope: ['openid', 'email', 'profile'],
|
|
clientId: env('NEXT_PRIVATE_GOOGLE_CLIENT_ID') ?? '',
|
|
clientSecret: env('NEXT_PRIVATE_GOOGLE_CLIENT_SECRET') ?? '',
|
|
redirectUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/callback/google`,
|
|
wellKnownUrl: 'https://accounts.google.com/.well-known/openid-configuration',
|
|
bypassEmailVerification: false,
|
|
};
|
|
|
|
export const MicrosoftAuthOptions: OAuthClientOptions = {
|
|
id: 'microsoft',
|
|
scope: ['openid', 'email', 'profile'],
|
|
clientId: env('NEXT_PRIVATE_MICROSOFT_CLIENT_ID') ?? '',
|
|
clientSecret: env('NEXT_PRIVATE_MICROSOFT_CLIENT_SECRET') ?? '',
|
|
redirectUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/callback/microsoft`,
|
|
wellKnownUrl: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration',
|
|
bypassEmailVerification: false,
|
|
};
|
|
|
|
export const OidcAuthOptions: OAuthClientOptions = {
|
|
id: 'oidc',
|
|
scope: ['openid', 'email', 'profile'],
|
|
clientId: env('NEXT_PRIVATE_OIDC_CLIENT_ID') ?? '',
|
|
clientSecret: env('NEXT_PRIVATE_OIDC_CLIENT_SECRET') ?? '',
|
|
redirectUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/callback/oidc`,
|
|
wellKnownUrl: env('NEXT_PRIVATE_OIDC_WELL_KNOWN') ?? '',
|
|
bypassEmailVerification: env('NEXT_PRIVATE_OIDC_SKIP_VERIFY') === 'true',
|
|
};
|
|
|
|
const iamUrl = env('IAM_URL') ?? 'https://hanzo.id';
|
|
|
|
export const HanzoAuthOptions: OAuthClientOptions = {
|
|
id: 'hanzo',
|
|
scope: ['openid', 'email', 'profile'],
|
|
clientId: env('IAM_CLIENT_ID') ?? '',
|
|
clientSecret: env('IAM_CLIENT_SECRET') ?? '',
|
|
redirectUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/callback/hanzo`,
|
|
wellKnownUrl: `${iamUrl}/.well-known/openid-configuration`,
|
|
bypassEmailVerification: true,
|
|
};
|