Skip to content

Commit 9802391

Browse files
committed
remove integration providers
Signed-off-by: Jan Richter <jrichter@redhat.com>
1 parent a128077 commit 9802391

10 files changed

Lines changed: 53 additions & 69 deletions

File tree

docs/api/helpers/login-helper.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ async loginAsGithubUser(): Promise<void>
4646
Login using GitHub OAuth.
4747

4848
**Required environment variables:**
49-
- `GH_USER_NAME`
50-
- `GH_USER_PASSWORD`
51-
- `GH_2FA_SECRET`
49+
- `VAULT_GH_USER_NAME`
50+
- `VAULT_GH_USER_PASSWORD`
51+
- `VAULT_GH_2FA_SECRET`
5252

5353
### `signOut()`
5454

docs/guide/configuration/environment-variables.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ For GitHub integration:
8383

8484
| Variable | Description | Required |
8585
|----------|-------------|----------|
86-
| `GITHUB_TOKEN` | GitHub personal access token | For API/auth |
87-
| `GH_USER_NAME` | GitHub username | For login |
88-
| `GH_USER_PASSWORD` | GitHub password | For login |
89-
| `GH_2FA_SECRET` | 2FA secret for OTP | For login |
86+
| `VAULT_GITHUB_USER_TOKEN` | GitHub personal access token | For API/auth |
87+
| `VAULT_GH_USER_NAME` | GitHub username | For login |
88+
| `VAULT_GH_USER_PASSWORD` | GitHub password | For login |
89+
| `VAULT_GH_2FA_SECRET` | 2FA secret for OTP | For login |
9090

9191
## Custom Variables
9292

docs/guide/deployment/authentication.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ test.beforeAll(async ({ rhdh }) => {
120120

121121
## GitHub Authentication
122122

123-
### Configuration
123+
Allows authentication using github OAuth application.
124124

125-
This will configure a github oauth application for authentication, as well as github integration and github org catalog provider:
125+
### Configuration
126126

127127
```typescript
128128
await rhdh.configure({ auth: "github" });
@@ -139,7 +139,6 @@ test.beforeEach(async ({ loginHelper }) => {
139139
});
140140
```
141141
By default, test user credentials will be pulled from the global workspace in vault.
142-
If you want to override them, you need to set the following env variables: `GH_USER_ID`, `GH_USER_PASS`, `GH_2FA_SECRET`
143142

144143
::: warning
145144
GitHub authentication requires 2FA secret for automated logins. This is more complex to set up than guest or Keycloak auth.
@@ -172,12 +171,6 @@ Configuring github auth provider will populate the following variables from glob
172171
|----------|-------------|
173172
| `VAULT_GITHUB_OAUTH_OVERLAYS_APP_ID` | GitHub OAuth application ID |
174173
| `VAULT_GITHUB_OAUTH_OVERLAYS_APP_SECRET` | GitHub OAuth application client secret |
175-
| `VAULT_GITHUB_OVERLAYS_APP_ID` | GitHub integration application ID |
176-
| `VAULT_GITHUB_OVERLAYS_APP_CLIENT_ID` | GitHub integration application client ID |
177-
| `VAULT_GITHUB_OVERLAYS_APP_CLIENT_SECRET` | GitHub integration application client secret |
178-
| `VAULT_GITHUB_OVERLAYS_APP_PRIVATE_KEY` | GitHub integration application private key |
179-
| `VAULT_GITHUB_OVERLAYS_APP_WEBHOOK_URL` | GitHub integration application webhook URL |
180-
| `VAULT_GITHUB_OVERLAYS_APP_WEBHOOK_SECRET` | GitHub integration application webhook secret |
181174
| `VAULT_GITHUB_ORG` | GitHub test organization for the catalog provider |
182175
| `VAULT_GH_USER_ID` | GitHub test user |
183176
| `VAULT_GH_USER_PASS` | Password for GitHub test user |

docs/guide/helpers/login-helper.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ await loginHelper.loginAsGithubUser();
6262
```
6363

6464
Required environment variables:
65-
- `GH_USER_NAME` - GitHub username
66-
- `GH_USER_PASSWORD` - GitHub password
67-
- `GH_2FA_SECRET` - GitHub 2FA secret (for OTP generation)
65+
- `VAULT_GH_USER_NAME` - GitHub username
66+
- `VAULT_GH_USER_PASSWORD` - GitHub password
67+
- `VAULT_GH_2FA_SECRET` - GitHub 2FA secret (for OTP generation)
6868

6969
::: warning
7070
GitHub login requires 2FA secret for automated OTP generation. This is more complex to set up.
@@ -192,9 +192,9 @@ test("login flow", async ({ page, loginHelper }) => {
192192

193193
| Variable | Description | Required |
194194
|----------|-------------|----------|
195-
| `GH_USER_NAME` | GitHub username | Yes |
196-
| `GH_USER_PASSWORD` | GitHub password | Yes |
197-
| `GH_2FA_SECRET` | 2FA secret for OTP | Yes |
195+
| `VAULT_GH_USER_NAME` | GitHub username | Yes |
196+
| `VAULT_GH_USER_PASSWORD` | GitHub password | Yes |
197+
| `VAULT_GH_2FA_SECRET` | 2FA secret for OTP | Yes |
198198

199199
## Troubleshooting
200200

src/deployment/rhdh/config/auth/github/app-config.yaml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,8 @@ auth:
1010
callbackUrl: ${RHDH_BASE_URL}/api/auth/github/handler/frame
1111
signInPage: github
1212
catalog:
13-
rules:
14-
- allow: [User, Group]
15-
providers:
16-
github:
17-
providerId:
18-
organization: "${GITHUB_ORG}"
19-
githubOrg:
20-
id: production
21-
githubUrl: ${GITHUB_URL}
22-
orgs: ["${GITHUB_ORG}"]
23-
integrations:
24-
github:
25-
- host: github.com
26-
apps:
27-
- appId: ${GITHUB_APP_APP_ID}
28-
clientId: ${GITHUB_APP_CLIENT_ID}
29-
clientSecret: ${GITHUB_APP_CLIENT_SECRET}
30-
webhookUrl: ${GITHUB_APP_WEBHOOK_URL}
31-
webhookSecret: ${GITHUB_APP_WEBHOOK_SECRET}
32-
privateKey: |
33-
${GITHUB_APP_PRIVATE_KEY}
13+
locations:
14+
- type: url
15+
target: https://github.com/janus-qe/test-user-entity/blob/main/user.yaml
16+
rules:
17+
- allow: [User]

src/deployment/rhdh/config/auth/github/secrets.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ metadata:
44
name: rhdh-secrets
55
type: Opaque
66
stringData:
7-
GITHUB_APP_APP_ID: $VAULT_GITHUB_OVERLAYS_APP_ID
8-
GITHUB_APP_CLIENT_ID: $VAULT_GITHUB_OVERLAYS_APP_CLIENT_ID
9-
GITHUB_APP_CLIENT_SECRET: $VAULT_GITHUB_OVERLAYS_APP_CLIENT_SECRET
10-
GITHUB_APP_PRIVATE_KEY: "${VAULT_GITHUB_OVERLAYS_APP_PRIVATE_KEY}"
11-
GITHUB_APP_WEBHOOK_URL: $VAULT_GITHUB_OVERLAYS_APP_WEBHOOK_SECRET
12-
GITHUB_APP_WEBHOOK_SECRET: $VAULT_GITHUB_OVERLAYS_APP_WEBHOOK_URL
137
GITHUB_OAUTH_APP_ID: $VAULT_GITHUB_OAUTH_OVERLAYS_APP_ID
148
GITHUB_OAUTH_APP_SECRET: $VAULT_GITHUB_OAUTH_OVERLAYS_APP_SECRET
159
GITHUB_ORG: $VAULT_GITHUB_ORG

src/deployment/rhdh/constants.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import path from "path";
22
import type { AuthProvider } from "./types.js";
3+
import { MergeOptions } from "../../utils/merge-yamls.js";
34

45
// Navigate from dist/deployment/rhdh/ to package root
56
const PACKAGE_ROOT = path.resolve(import.meta.dirname, "../../..");
@@ -33,7 +34,12 @@ export const DEFAULT_CONFIG_PATHS = {
3334

3435
export const AUTH_CONFIG_PATHS: Record<
3536
AuthProvider,
36-
{ appConfig: string; secrets: string; dynamicPlugins: string }
37+
{
38+
appConfig: string;
39+
secrets: string;
40+
dynamicPlugins: string;
41+
mergeStrategy?: MergeOptions;
42+
}
3743
> = {
3844
guest: {
3945
appConfig: path.join(
@@ -70,6 +76,7 @@ export const AUTH_CONFIG_PATHS: Record<
7076
PACKAGE_ROOT,
7177
"dist/deployment/rhdh/config/auth/github/dynamic-plugins.yaml",
7278
),
79+
mergeStrategy: { arrayMergeStrategy: { byKey: "target" } },
7380
},
7481
};
7582

src/deployment/rhdh/deployment.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,14 @@ export class RHDHDeployment {
6060

6161
private async _applyAppConfig(): Promise<void> {
6262
const authConfig = AUTH_CONFIG_PATHS[this.deploymentConfig.auth];
63-
const appConfigYaml = await mergeYamlFilesIfExists([
64-
DEFAULT_CONFIG_PATHS.appConfig,
65-
authConfig.appConfig,
66-
this.deploymentConfig.appConfig,
67-
]);
63+
const appConfigYaml = await mergeYamlFilesIfExists(
64+
[
65+
DEFAULT_CONFIG_PATHS.appConfig,
66+
authConfig.appConfig,
67+
this.deploymentConfig.appConfig,
68+
],
69+
authConfig.mergeStrategy,
70+
);
6871
this._logBoxen("App Config", appConfigYaml);
6972

7073
await this.k8sClient.applyConfigMapFromObject(

src/playwright/helpers/api-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class APIHelper {
2323
method: method,
2424
headers: {
2525
Accept: "application/vnd.github+json",
26-
Authorization: `Bearer ${process.env.GH_RHDH_QE_USER_TOKEN || process.env.VAULT_GITHUB_USER_TOKEN}`,
26+
Authorization: `Bearer ${process.env.VAULT_GITHUB_USER_TOKEN}`,
2727
"X-GitHub-Api-Version": this.githubAPIVersion,
2828
},
2929
};

src/playwright/helpers/common.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@ export class LoginHelper {
4343
await this.page.fill("#login_field", userid);
4444

4545
switch (userid) {
46-
case process.env.GH_USER_ID:
47-
await this.page.fill("#password", process.env.GH_USER_PASS as string);
46+
case process.env.VAULT_GH_USER_ID:
47+
await this.page.fill(
48+
"#password",
49+
process.env.VAULT_GH_USER_PASS as string,
50+
);
4851
break;
49-
case process.env.GH_USER2_ID:
50-
await this.page.fill("#password", process.env.GH_USER2_PASS as string);
52+
case process.env.VAULT_GH_USER2_ID:
53+
await this.page.fill(
54+
"#password",
55+
process.env.VAULT_GH_USER2_PASS as string,
56+
);
5157
break;
5258
default:
5359
throw new Error("Invalid User ID");
@@ -95,14 +101,10 @@ export class LoginHelper {
95101
await this.page.waitForSelector("nav a", { timeout: 10_000 });
96102
}
97103

98-
async loginAsGithubUser(userid: string = process.env.GH_USER_ID as string) {
104+
async loginAsGithubUser(
105+
userid: string = process.env.VAULT_GH_USER_ID as string,
106+
) {
99107
// Load the defaults from vault if not set by the user
100-
if (!userid) {
101-
userid = process.env.VAULT_GH_USER_ID as string;
102-
process.env.GH_USER_ID = userid;
103-
process.env.GH_USER_PASS = process.env.VAULT_GH_USER_PASS;
104-
process.env.GH_2FA_SECRET = process.env.VAULT_GH_2FA_SECRET;
105-
}
106108
const sessionFileName = `authState_${userid}.json`;
107109

108110
// Check if a session file for this specific user already exists
@@ -214,8 +216,9 @@ export class LoginHelper {
214216

215217
getGitHub2FAOTP(userid: string): string {
216218
const secrets: { [key: string]: string | undefined } = {
217-
[process.env.GH_USER_ID as string]: process.env.GH_2FA_SECRET,
218-
[process.env.GH_USER2_ID as string]: process.env.GH_USER2_2FA_SECRET,
219+
[process.env.VAULT_GH_USER_ID as string]: process.env.VAULT_GH_2FA_SECRET,
220+
[process.env.VAULT_GH_USER2_ID as string]:
221+
process.env.VAULT_GH_USER2_2FA_SECRET,
219222
};
220223

221224
const secret = secrets[userid];

0 commit comments

Comments
 (0)