mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 16:16:02 +00:00
oauth test WIP
This commit is contained in:
7
e2e-tests/containers/dex/Dockerfile
Normal file
7
e2e-tests/containers/dex/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM dexidp/dex:v2.35.3
|
||||
|
||||
COPY ./dex-config.yaml /etc/dex/cfg/config.yaml
|
||||
|
||||
EXPOSE 5556
|
||||
|
||||
CMD ["dex", "serve", "/etc/dex/cfg/config.yaml"]
|
||||
22
e2e-tests/containers/dex/dex-config.yaml
Normal file
22
e2e-tests/containers/dex/dex-config.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
issuer: http://dex:5556/dex
|
||||
storage:
|
||||
type: memory
|
||||
web:
|
||||
http: 0.0.0.0:5556
|
||||
|
||||
oauth2:
|
||||
skipApprovalScreen: true
|
||||
|
||||
staticClients:
|
||||
- id: my-app
|
||||
redirectURIs:
|
||||
- 'http://localhost:3000/callback'
|
||||
name: 'My Test App'
|
||||
secret: my-secret
|
||||
|
||||
enablePasswordDB: true
|
||||
staticPasswords:
|
||||
- email: "test@example.com"
|
||||
hash: "$2y$05$olu30d4lgn7r1/Xfe13N1.5dz0N9AVlKXUFIxXUYVkhiq8D6gwYGG"
|
||||
username: "test"
|
||||
userID: "1234"
|
||||
@@ -22,6 +22,9 @@ module.exports = defineConfig({
|
||||
case 'portal':
|
||||
serverProcess = exec('yarn start:portal:local');
|
||||
break;
|
||||
case 'oauth':
|
||||
serverProcess = exec('yarn start:oauth:local');
|
||||
break;
|
||||
}
|
||||
|
||||
await waitOn({ resources: ['http://localhost:3000'] });
|
||||
|
||||
14
e2e-tests/cypress/e2e/oauth.cy.js
Normal file
14
e2e-tests/cypress/e2e/oauth.cy.js
Normal file
@@ -0,0 +1,14 @@
|
||||
describe('OAuth', () => {
|
||||
it('OAuth login', () => {
|
||||
cy.visit('http://localhost:3000');
|
||||
|
||||
// login on DEX
|
||||
cy.get('#login').clear().type('test@example.com');
|
||||
cy.get('#password').clear().type('test');
|
||||
cy.get('#submit-login').click();
|
||||
|
||||
// check DbGate connection
|
||||
cy.contains('MySql-connection').click();
|
||||
cy.contains('performance_schema');
|
||||
});
|
||||
});
|
||||
15
e2e-tests/env/oauth-ci/.env
vendored
Normal file
15
e2e-tests/env/oauth-ci/.env
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
CONNECTIONS=mysql
|
||||
|
||||
LABEL_mysql=MySql-connection
|
||||
SERVER_mysql=mysql
|
||||
USER_mysql=root
|
||||
PASSWORD_mysql=Pwd2020Db
|
||||
PORT_mysql=3306
|
||||
ENGINE_mysql=mysql@dbgate-plugin-mysql
|
||||
|
||||
OAUTH_AUTH=http://dex/dex/auth
|
||||
OAUTH_TOKEN=http://dex/dex/token
|
||||
OAUTH_CLIENT_ID=my-app
|
||||
OAUTH_CLIENT_SECRET=my-secret
|
||||
OAUTH_LOGIN_FIELD=username
|
||||
OAUTH_SCOPE=openid
|
||||
1
e2e-tests/env/oauth-local/.env
vendored
1
e2e-tests/env/oauth-local/.env
vendored
@@ -12,3 +12,4 @@ OAUTH_TOKEN=http://localhost:16009/dex/token
|
||||
OAUTH_CLIENT_ID=my-app
|
||||
OAUTH_CLIENT_SECRET=my-secret
|
||||
OAUTH_LOGIN_FIELD=username
|
||||
OAUTH_SCOPE=openid
|
||||
Reference in New Issue
Block a user