Merge remote-tracking branch 'origin' into chuck/web-2435-move-comments-and-webhooks-without-attachments
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
export { WorkspaceInviteResourceType } from '@/modules/workspacesCore/domain/constants'
|
||||
|
||||
export const WorkspaceEarlyAdopterDiscount = {
|
||||
name: '50% Early Adopter Discount',
|
||||
amount: 0.5
|
||||
}
|
||||
@@ -68,7 +68,7 @@ export type GetWorkspaceBySlugOrId = (args: {
|
||||
}) => Promise<Workspace | null>
|
||||
|
||||
export type GetWorkspaces = (args: {
|
||||
workspaceIds: string[]
|
||||
workspaceIds?: string[]
|
||||
userId?: string
|
||||
}) => Promise<WorkspaceWithOptionalRole[]>
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { UserSsoSessionRecord } from '@/modules/workspaces/domain/sso/types'
|
||||
import {
|
||||
OidcProfile,
|
||||
SpeckleOidcProfile,
|
||||
UserSsoSessionRecord
|
||||
} from '@/modules/workspaces/domain/sso/types'
|
||||
import { UnknownObject, UserinfoResponse } from 'openid-client'
|
||||
|
||||
/**
|
||||
* Get the default expiration time for an SSO session based on the current time.
|
||||
@@ -13,3 +18,22 @@ export const getDefaultSsoSessionExpirationDate = (): Date => {
|
||||
export const isValidSsoSession = (session: UserSsoSessionRecord): boolean => {
|
||||
return session.validUntil.getTime() > new Date().getTime()
|
||||
}
|
||||
|
||||
export const isValidOidcProfile = (
|
||||
profile: UserinfoResponse<UnknownObject, UnknownObject>
|
||||
): profile is OidcProfile => {
|
||||
return !!profile.email || !!profile.upn
|
||||
}
|
||||
|
||||
const isSpeckleOidcProfile = (
|
||||
profile: OidcProfile
|
||||
): profile is OidcProfile<SpeckleOidcProfile> => {
|
||||
return Object.hasOwn(profile, 'email')
|
||||
}
|
||||
|
||||
/**
|
||||
* Special handling required in case we encounter Entra ID with a particular configuration.
|
||||
*/
|
||||
export const getEmailFromOidcProfile = (profile: OidcProfile): string => {
|
||||
return isSpeckleOidcProfile(profile) ? profile.email : profile.upn
|
||||
}
|
||||
|
||||
@@ -53,3 +53,23 @@ export type OidcProviderAttributes = {
|
||||
export type SsoSessionState = {
|
||||
isValidationFlow: boolean
|
||||
}
|
||||
|
||||
export type OidcProfile<
|
||||
OidcProviderProperties = SpeckleOidcProfile | MicrosoftEntraIdProfile
|
||||
> = {
|
||||
sub: string
|
||||
} & OidcProviderProperties
|
||||
|
||||
/**
|
||||
* OIDC profile properties required by Speckle SSO logic.
|
||||
*/
|
||||
export type SpeckleOidcProfile = {
|
||||
email: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Because of course.
|
||||
*/
|
||||
export type MicrosoftEntraIdProfile = {
|
||||
upn: string
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export { WorkspaceInviteResourceTarget } from '@/modules/workspacesCore/domain/types'
|
||||
import { LimitedUserRecord, UserWithRole } from '@/modules/core/helpers/types'
|
||||
import { WorkspaceInviteResourceType } from '@/modules/workspaces/domain/constants'
|
||||
import { WorkspaceInviteResourceType } from '@/modules/workspacesCore/domain/constants'
|
||||
import { StreamRoles, WorkspaceRoles } from '@speckle/shared'
|
||||
|
||||
declare module '@/modules/serverinvites/domain/types' {
|
||||
|
||||
Reference in New Issue
Block a user