forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement oauth in UI (airbytehq#6385)
* Implement auth * Implement auth * Fix wrong changes * Place authenticate button in the proper place * Finish oauth implementation * Temporary ignore test * Fix stories * Fix react-widgets UI * Remove unnecessary mock * Add support for oneOf case * Temporary disable test * Fix path * Fix lock file * Do not flush values on auth * Apply last auth changes * Move button within section * Leave comment about dirty tricks * Call WebBackend endpoints for create instead of core one
- Loading branch information
Showing
57 changed files
with
3,387 additions
and
749 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { addons } from "@storybook/addons"; | ||
import theme from "./theme"; | ||
|
||
addons.setConfig({ | ||
panelPosition: "bottom", | ||
theme | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { create } from "@storybook/theming/create"; | ||
import Image from "./logo.png"; | ||
|
||
export default create({ | ||
brandTitle: "Airbyte", | ||
brandUrl: "https://airbyte.com", | ||
brandImage: Image, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
airbyte-webapp/src/core/domain/connector/DestinationAuthService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { AirbyteRequestService } from "core/request/AirbyteRequestService"; | ||
import { DestinationGetConsentPayload } from "./types"; | ||
|
||
class DestinationAuthService extends AirbyteRequestService { | ||
get url(): string { | ||
return "destination_oauths"; | ||
} | ||
|
||
public getConsentUrl( | ||
body: DestinationGetConsentPayload | ||
): Promise<{ consentUrl: string }> { | ||
return this.fetch<{ consentUrl: string }>( | ||
`${this.url}/get_consent_url`, | ||
body | ||
); | ||
} | ||
|
||
public completeOauth( | ||
body: DestinationGetConsentPayload & { | ||
queryParams: Record<string, unknown>; | ||
} | ||
): Promise<Record<string, unknown>> { | ||
return this.fetch<Record<string, unknown>>( | ||
`${this.url}/complete_oauth`, | ||
body | ||
); | ||
} | ||
} | ||
|
||
export { DestinationAuthService }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
airbyte-webapp/src/core/domain/connector/SourceAuthService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { AirbyteRequestService } from "core/request/AirbyteRequestService"; | ||
import { SourceGetConsentPayload } from "./types"; | ||
|
||
class SourceAuthService extends AirbyteRequestService { | ||
get url(): string { | ||
return "source_oauths"; | ||
} | ||
|
||
public getConsentUrl( | ||
body: SourceGetConsentPayload | ||
): Promise<{ consentUrl: string }> { | ||
return this.fetch<{ consentUrl: string }>( | ||
`${this.url}/get_consent_url`, | ||
body | ||
); | ||
} | ||
|
||
public completeOauth( | ||
body: SourceGetConsentPayload & { | ||
queryParams: Record<string, unknown>; | ||
} | ||
): Promise<Record<string, unknown>> { | ||
return this.fetch<Record<string, unknown>>( | ||
`${this.url}/complete_oauth`, | ||
body | ||
); | ||
} | ||
} | ||
|
||
export { SourceAuthService }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./connector"; | ||
export * from "./types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
import { SourceDefinition } from "core/resources/SourceDefinition"; | ||
import { ConnectorDefinition } from "./connector"; | ||
import { | ||
ConnectorDefinition, | ||
ConnectorDefinitionSpecification, | ||
SourceDefinitionSpecification, | ||
} from "./types"; | ||
|
||
export function isSourceDefinition( | ||
connector: ConnectorDefinition | ||
): connector is SourceDefinition { | ||
return (connector as SourceDefinition).sourceDefinitionId !== undefined; | ||
} | ||
|
||
export function isSourceDefinitionSpecification( | ||
connector: ConnectorDefinitionSpecification | ||
): connector is SourceDefinitionSpecification { | ||
return ( | ||
(connector as SourceDefinitionSpecification).sourceDefinitionId !== | ||
undefined | ||
); | ||
} | ||
|
||
// eslint-disable-next-line no-template-curly-in-string | ||
export const SOURCE_NAMESPACE_TAG = "${SOURCE_NAMESPACE}"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { ConnectionSpecification } from "core/domain/connection"; | ||
import { DestinationSyncMode } from "core/domain/catalog"; | ||
import { SourceDefinition } from "core/resources/SourceDefinition"; | ||
import { DestinationDefinition } from "core/resources/DestinationDefinition"; | ||
|
||
export type ConnectorDefinition = SourceDefinition | DestinationDefinition; | ||
|
||
interface ConnectorDefinitionSpecificationBase { | ||
connectionSpecification: ConnectionSpecification; | ||
documentationUrl: string; | ||
authSpecification?: { | ||
type: "oauth2.0"; | ||
oauth2Specification: { | ||
rootObject?: string[]; | ||
oauthFlowInitParameters?: string[][]; | ||
oauthFlowOutputParameters?: string[][]; | ||
}; | ||
}; | ||
} | ||
|
||
export type ConnectorDefinitionSpecification = | ||
| DestinationDefinitionSpecification | ||
| SourceDefinitionSpecification; | ||
|
||
export interface DestinationDefinitionSpecification | ||
extends ConnectorDefinitionSpecificationBase { | ||
destinationDefinitionId: string; | ||
supportedDestinationSyncModes: DestinationSyncMode[]; | ||
supportsDbt: boolean; | ||
supportsNormalization: boolean; | ||
} | ||
|
||
export interface SourceDefinitionSpecification | ||
extends ConnectorDefinitionSpecificationBase { | ||
sourceDefinitionId: string; | ||
} | ||
|
||
export interface SourceGetConsentPayload { | ||
redirectUrl: string; | ||
sourceDefinitionId: string; | ||
workspaceId: string; | ||
} | ||
|
||
export interface DestinationGetConsentPayload { | ||
redirectUrl: string; | ||
destinationDefinitionId: string; | ||
workspaceId: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./types"; | ||
export * from "./schemaToUiWidget"; | ||
export * from "./schemaToYup"; | ||
export * from "./utils"; |
Oops, something went wrong.