refacto(*): rename hostname to custom domain (#10100)
This commit is contained in:
@ -234,7 +234,7 @@ export class AuthResolver {
|
||||
loginToken,
|
||||
workspace: {
|
||||
id: workspace.id,
|
||||
workspaceUrls: this.domainManagerService.getworkspaceUrls(workspace),
|
||||
workspaceUrls: this.domainManagerService.getWorkspaceUrls(workspace),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ export class GoogleAuthController {
|
||||
return res.redirect(
|
||||
this.guardRedirectService.getRedirectErrorUrlAndCaptureExceptions(
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
currentWorkspace,
|
||||
),
|
||||
),
|
||||
|
||||
@ -119,7 +119,7 @@ export class MicrosoftAuthController {
|
||||
return res.redirect(
|
||||
this.guardRedirectService.getRedirectErrorUrlAndCaptureExceptions(
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
currentWorkspace,
|
||||
),
|
||||
),
|
||||
|
||||
@ -157,7 +157,7 @@ export class SSOAuthController {
|
||||
return res.redirect(
|
||||
this.guardRedirectService.getRedirectErrorUrlAndCaptureExceptions(
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
workspaceIdentityProvider?.workspace,
|
||||
),
|
||||
),
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
IdentityProviderType,
|
||||
SSOIdentityProviderStatus,
|
||||
} from 'src/engine/core-modules/sso/workspace-sso-identity-provider.entity';
|
||||
import { workspaceUrls } from 'src/engine/core-modules/workspace/dtos/workspace-endpoints.dto';
|
||||
import { workspaceUrls } from 'src/engine/core-modules/workspace/dtos/workspace-urls.dto';
|
||||
|
||||
@ObjectType()
|
||||
class SSOConnection {
|
||||
@ -38,9 +38,6 @@ export class AvailableWorkspaceOutput {
|
||||
@Field(() => workspaceUrls)
|
||||
workspaceUrls: workspaceUrls;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
hostname?: string;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
logo?: string;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { workspaceUrlsAndId } from 'src/engine/core-modules/workspace/dtos/workspace-subdomain-id.dto';
|
||||
import { WorkspaceUrlsAndId } from 'src/engine/core-modules/workspace/dtos/workspace-subdomain-id.dto';
|
||||
|
||||
import { AuthToken } from './token.entity';
|
||||
|
||||
@ -9,6 +9,6 @@ export class SignUpOutput {
|
||||
@Field(() => AuthToken)
|
||||
loginToken: AuthToken;
|
||||
|
||||
@Field(() => workspaceUrlsAndId)
|
||||
workspace: workspaceUrlsAndId;
|
||||
@Field(() => WorkspaceUrlsAndId)
|
||||
workspace: WorkspaceUrlsAndId;
|
||||
}
|
||||
|
||||
@ -30,7 +30,9 @@ export class EnterpriseFeaturesEnabledGuard implements CanActivate {
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromContext(context),
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromContext(
|
||||
context,
|
||||
),
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
@ -53,7 +53,9 @@ export class GoogleAPIsOauthExchangeCodeForTokenGuard extends AuthGuard(
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromContext(context),
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromContext(
|
||||
context,
|
||||
),
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
@ -71,7 +71,7 @@ export class GoogleAPIsOauthRequestCodeGuard extends AuthGuard('google-apis') {
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
workspace,
|
||||
),
|
||||
);
|
||||
|
||||
@ -51,7 +51,7 @@ export class GoogleOauthGuard extends AuthGuard('google') {
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
workspace,
|
||||
),
|
||||
);
|
||||
|
||||
@ -31,7 +31,9 @@ export class GoogleProviderEnabledGuard implements CanActivate {
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromContext(context),
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromContext(
|
||||
context,
|
||||
),
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
@ -57,7 +57,9 @@ export class MicrosoftAPIsOauthExchangeCodeForTokenGuard extends AuthGuard(
|
||||
AuthExceptionCode.INSUFFICIENT_SCOPES,
|
||||
)
|
||||
: error,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromContext(context),
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromContext(
|
||||
context,
|
||||
),
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
@ -72,7 +72,7 @@ export class MicrosoftAPIsOauthRequestCodeGuard extends AuthGuard(
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
workspace,
|
||||
),
|
||||
);
|
||||
|
||||
@ -39,7 +39,7 @@ export class MicrosoftOAuthGuard extends AuthGuard('microsoft') {
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
workspace,
|
||||
),
|
||||
);
|
||||
|
||||
@ -31,7 +31,9 @@ export class MicrosoftProviderEnabledGuard implements CanActivate {
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromContext(context),
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromContext(
|
||||
context,
|
||||
),
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
@ -80,7 +80,7 @@ export class OIDCAuthGuard extends AuthGuard('openidconnect') {
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
identityProvider?.workspace,
|
||||
),
|
||||
);
|
||||
|
||||
@ -14,30 +14,16 @@ import { SSOService } from 'src/engine/core-modules/sso/services/sso.service';
|
||||
import { GuardRedirectService } from 'src/engine/core-modules/guard-redirect/services/guard-redirect.service';
|
||||
import { SSOConfiguration } from 'src/engine/core-modules/sso/types/SSOConfigurations.type';
|
||||
import { WorkspaceSSOIdentityProvider } from 'src/engine/core-modules/sso/workspace-sso-identity-provider.entity';
|
||||
import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';
|
||||
|
||||
@Injectable()
|
||||
export class SAMLAuthGuard extends AuthGuard('saml') {
|
||||
constructor(
|
||||
private readonly sSOService: SSOService,
|
||||
private readonly guardRedirectService: GuardRedirectService,
|
||||
private readonly exceptionHandlerService: ExceptionHandlerService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
private getRelayStateByRequest(request: Request) {
|
||||
try {
|
||||
const relayStateRaw = request.body.RelayState || request.query.RelayState;
|
||||
|
||||
if (relayStateRaw) {
|
||||
return JSON.parse(relayStateRaw);
|
||||
}
|
||||
} catch (error) {
|
||||
this.exceptionHandlerService.captureExceptions(error);
|
||||
}
|
||||
}
|
||||
|
||||
async canActivate(context: ExecutionContext) {
|
||||
const request = context.switchToHttp().getRequest<Request>();
|
||||
|
||||
@ -63,7 +49,7 @@ export class SAMLAuthGuard extends AuthGuard('saml') {
|
||||
this.guardRedirectService.dispatchErrorFromGuard(
|
||||
context,
|
||||
err,
|
||||
this.guardRedirectService.getSubdomainAndHostnameFromWorkspace(
|
||||
this.guardRedirectService.getSubdomainAndCustomDomainFromWorkspace(
|
||||
identityProvider?.workspace,
|
||||
),
|
||||
);
|
||||
|
||||
@ -459,7 +459,7 @@ export class AuthService {
|
||||
billingCheckoutSessionState,
|
||||
}: {
|
||||
loginToken: string;
|
||||
workspace: Pick<Workspace, 'subdomain' | 'hostname'>;
|
||||
workspace: Pick<Workspace, 'subdomain' | 'customDomain'>;
|
||||
billingCheckoutSessionState?: string;
|
||||
}) {
|
||||
const url = this.domainManagerService.buildWorkspaceURL({
|
||||
|
||||
Reference in New Issue
Block a user