feat(sso): active user sso information (#3432)

* feat(workspaces): add workspace sso feature flag

* feat(workspaceSso): wip validate sso

* feat(workspaces): validate and add sso provider to the workspace with user sso sessions

* feat(workspaces): validate and add sso provider to the workspace with user sso sessions

* WIP

* fix(sso): restructure to handle all branches at end of flow

* fix(sso): add and validate emails used for sso

* fix(sso): park progress

* chore(workspaces): review sso login/valdate

* fix(sso): adjust validate url

* chore(sso): auth header puzzle

* fix(sso): happy-path config

* chore(gql): gqlgen

* fix(sso): almost almost

* fix(sso): auth endpoint

* a lil more terse

* fix(sso): light at the end of the tunnel

* fix(sso): improve catch block error messages

* fix(sso): session lifespan => validUntil

* fix(sso): I think we've got it

* feat(sso): limited workspace values for public sso login

* fix(sso): use factory functions

* fix(sso): til decrypt is single-use

* fix(sso): correct usage of access codes

* fix(sso): use finalize middleware in all routes

* chore(sso): cheeky tweak

* fix(sso): move some types around

* fix(sso): stencil final shape I'm sleepy

* fix(sso): more factories more factories

* fix(sso): on to final boss of factories

* fix(sso): needs a haircut but she works

* fix(sso): init rest w function, not side-effects

* fix(sso): /authn => /sso

* chore(sso): errors

* chore(sso): test test test

* chore(sso): test all the corners

* feat(sso): list workspace sso memberships

* chore(sso): tests, expose in rest

* fix(sso): sketch active user auth

* fix(sso): expose search via gql

* fix(sso): active user session information

* chore(sso): sso session test utils

* chore(sso): test sso session repo/services

* chore(sso): gqlgen

* fix(sso): simplify gql resolver structure

* chore(sso): gqlgen

---------

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
This commit is contained in:
Chuck Driesler
2024-11-05 12:27:46 +00:00
committed by GitHub
parent 3006a20a0f
commit b195df37d6
23 changed files with 762 additions and 53 deletions
@@ -6,6 +6,7 @@ export const workspaceEventNamespace = 'workspace' as const
const workspaceEventPrefix = `${workspaceEventNamespace}.` as const
export const WorkspaceEvents = {
Authorized: `${workspaceEventPrefix}authorized`,
Created: `${workspaceEventPrefix}created`,
Updated: `${workspaceEventPrefix}updated`,
RoleDeleted: `${workspaceEventPrefix}role-deleted`,
@@ -15,6 +16,10 @@ export const WorkspaceEvents = {
export type WorkspaceEvents = (typeof WorkspaceEvents)[keyof typeof WorkspaceEvents]
type WorkspaceAuthorizedPayload = {
userId: string | null
workspaceId: string
}
type WorkspaceCreatedPayload = Workspace & {
createdByUserId: string
}
@@ -31,6 +36,7 @@ type WorkspaceJoinedFromDiscoveryPayload = {
}
export type WorkspaceEventsPayloads = {
[WorkspaceEvents.Authorized]: WorkspaceAuthorizedPayload
[WorkspaceEvents.Created]: WorkspaceCreatedPayload
[WorkspaceEvents.Updated]: WorkspaceUpdatedPayload
[WorkspaceEvents.RoleDeleted]: WorkspaceRoleDeletedPayload
@@ -1,11 +1,13 @@
import { MutationsObjectGraphQLReturn } from '@/modules/core/helpers/graphTypes'
import { LimitedUserRecord } from '@/modules/core/helpers/types'
import { WorkspaceSsoProviderRecord } from '@/modules/workspaces/domain/sso/types'
import { WorkspaceTeamMember } from '@/modules/workspaces/domain/types'
import { Workspace } from '@/modules/workspacesCore/domain/types'
import { WorkspaceRoles } from '@speckle/shared'
export type WorkspaceGraphQLReturn = Workspace
export type WorkspaceBillingGraphQLReturn = { parent: Workspace }
export type WorkspaceSsoGraphQLReturn = WorkspaceSsoProviderRecord
export type WorkspaceMutationsGraphQLReturn = MutationsObjectGraphQLReturn
export type WorkspaceInviteMutationsGraphQLReturn = MutationsObjectGraphQLReturn
export type WorkspaceProjectMutationsGraphQLReturn = MutationsObjectGraphQLReturn