@@ -6,11 +6,13 @@ import { SaasUsualUserRegisterDS } from '../../entities/user/application/data-st
66import { FoundUserDto } from '../../entities/user/dto/found-user.dto.js' ;
77import { ExternalRegistrationProviderEnum } from '../../entities/user/enums/external-registration-provider.enum.js' ;
88import { UserEntity } from '../../entities/user/user.entity.js' ;
9+ import { InTransactionEnum } from '../../enums/in-transaction.enum.js' ;
910import { SentryInterceptor } from '../../interceptors/sentry.interceptor.js' ;
1011import { SuccessResponse } from './data-structures/common-responce.ds.js' ;
1112import { RegisterCompanyWebhookDS } from './data-structures/register-company.ds.js' ;
1213import { RegisteredCompanyDS } from './data-structures/registered-company.ds.js' ;
1314import { SaasRegisterUserWithGithub } from './data-structures/saas-register-user-with-github.js' ;
15+ import { SaasSAMLUserRegisterDS } from './data-structures/saas-saml-user-register.ds.js' ;
1416import { SaasRegisterUserWithGoogleDS } from './data-structures/sass-register-user-with-google.js' ;
1517import {
1618 ICompanyRegistration ,
@@ -23,9 +25,9 @@ import {
2325 ISaaSGetUsersCountInCompany ,
2426 ISaasGetUsersInfosByEmail ,
2527 ISaasRegisterUser ,
28+ ISaasSAMLRegisterUser ,
2629 ISuspendUsers ,
2730} from './use-cases/saas-use-cases.interface.js' ;
28- import { InTransactionEnum } from '../../enums/in-transaction.enum.js' ;
2931
3032@UseInterceptors ( SentryInterceptor )
3133@Controller ( 'saas' )
@@ -48,6 +50,8 @@ export class SaasController {
4850 private readonly loginUserWithGoogleUseCase : ILoginUserWithGoogle ,
4951 @Inject ( UseCaseType . SAAS_LOGIN_USER_WITH_GITHUB )
5052 private readonly loginUserWithGithubUseCase : ILoginUserWithGitHub ,
53+ @Inject ( UseCaseType . SAAS_REGISTER_USER_WITH_SAML )
54+ private readonly registerUserWithSamlUseCase : ISaasSAMLRegisterUser ,
5155 @Inject ( UseCaseType . SAAS_SUSPEND_USERS )
5256 private readonly suspendUsersUseCase : ISuspendUsers ,
5357 @Inject ( UseCaseType . SAAS_GET_COMPANY_INFO_BY_USER_ID )
@@ -203,4 +207,28 @@ export class SaasController {
203207 async unfreezeConnectionsInCompany ( @Body ( 'companyIds' ) companyIds : Array < string > ) {
204208 return await this . unfreezeConnectionsInCompanyUseCase . execute ( { companyIds } ) ;
205209 }
210+
211+ @ApiOperation ( { summary : 'Register user with SAML' } )
212+ @ApiBody ( { type : SaasSAMLUserRegisterDS } )
213+ @ApiResponse ( {
214+ status : 201 ,
215+ } )
216+ @Post ( 'user/saml/login' )
217+ async registerUserWithSaml (
218+ @Body ( 'email' ) email : string ,
219+ @Body ( 'name' ) name : string ,
220+ @Body ( 'companyId' ) companyId : string ,
221+ @Body ( 'samlConfigId' ) samlConfigId : string ,
222+ @Body ( 'samlNameId' ) samlNameId : string ,
223+ @Body ( 'samlAttributes' ) samlAttributes : Record < string , any > ,
224+ ) : Promise < UserEntity > {
225+ return await this . registerUserWithSamlUseCase . execute ( {
226+ email,
227+ name,
228+ companyId,
229+ samlConfigId,
230+ samlNameId,
231+ samlAttributes
232+ } ) ;
233+ }
206234}
0 commit comments