Ignore redirectToPath for Okta and OIDC (#5186)

This commit is contained in:
Kamil Kisiela 2024-07-09 18:33:39 +02:00 committed by GitHub
parent e74722d9d9
commit fff0a790fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 9 deletions

View file

@ -7,7 +7,6 @@ import { WEB_APP_URL } from '../../../shared/providers/tokens';
import {
ChannelConfirmationInput,
CommunicationAdapter,
createMDLink,
SchemaChangeNotificationInput,
slackCoderize,
} from './common';
@ -44,15 +43,15 @@ export class SlackCommunicationAdapter implements CommunicationAdapter {
const client = new WebClient(input.integrations.slack.token, {});
const totalChanges = input.event.changes.length + input.event.messages.length;
const projectLink = createMDLink({
const projectLink = this.createLink({
text: input.event.project.name,
url: `${this.appBaseUrl}/${input.event.organization.cleanId}/${input.event.project.cleanId}`,
});
const targetLink = createMDLink({
const targetLink = this.createLink({
text: input.event.target.name,
url: `${this.appBaseUrl}/${input.event.organization.cleanId}/${input.event.project.cleanId}/${input.event.target.cleanId}`,
});
const viewLink = createMDLink({
const viewLink = this.createLink({
text: 'view details',
url: `${this.appBaseUrl}/${input.event.organization.cleanId}/${input.event.project.cleanId}/${input.event.target.cleanId}/history/${input.event.schema.id}`,
});
@ -107,7 +106,7 @@ export class SlackCommunicationAdapter implements CommunicationAdapter {
: `I will no longer send here notifications`;
try {
const projectLink = createMDLink({
const projectLink = this.createLink({
text: input.event.project.name,
url: `${this.appBaseUrl}/${input.event.organization.cleanId}/${input.event.project.cleanId}`,
});

View file

@ -12,10 +12,12 @@ export const startAuthFlowForProvider = async (
throw new Error(`Provider for ${thirdPartyId} is not configured`);
}
const providersWithRedirectPartSupport = ['github'];
// Google does not support ?redirectToPath= query param.
// It gives back an error saying that the redirect_uri is not allowed.
const redirectPart =
redirectToPath && thirdPartyId !== 'google'
redirectToPath && providersWithRedirectPartSupport.includes(thirdPartyId)
? `?redirectToPath=${encodeURIComponent(redirectToPath)}`
: '';
const authUrl = await getAuthorisationURLWithQueryParamsAndSetState({

View file

@ -69,10 +69,10 @@ export const getOIDCOverrides = (): UserInput['override'] => ({
}),
});
export const startAuthFlowForOIDCProvider = async (oidcId: string, redirectToPath: string) => {
export const startAuthFlowForOIDCProvider = async (oidcId: string) => {
const authUrl = await getAuthorisationURLWithQueryParamsAndSetState({
thirdPartyId: 'oidc',
frontendRedirectURI: `${env.appBaseUrl}/auth/callback/oidc?redirectToPath=${encodeURIComponent(redirectToPath)}`,
frontendRedirectURI: `${env.appBaseUrl}/auth/callback/oidc`,
// The user context is very important - we store the OIDC ID so we can use it later on.
userContext: {
oidcId,

View file

@ -15,7 +15,7 @@ function AuthOIDC(props: { oidcId: string; redirectToPath: string }) {
throw new Error('OIDC provider is not configured');
}
await startAuthFlowForOIDCProvider(props.oidcId, props.redirectToPath);
await startAuthFlowForOIDCProvider(props.oidcId);
},
});