mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
add AuthConfig v2 example (#937)
### What - Added `AuthConfig` v2 config example in `static/auth/auth_config_v2.json` - Moved exisiting `auth_config.json` to `static/auth/` - Removed unused `pre_plugins.json` If one wants to start the engine with a v2 of AuthConfig, `static/auth/auth_config_v2.json` can be used. V3_GIT_ORIGIN_REV_ID: 471f8ae43ab02c2182457804a24b8445bb41f06c
This commit is contained in:
parent
27c8e0085c
commit
f9e4502c96
@ -46,7 +46,7 @@ and the new V3 concepts.
|
||||
```sh
|
||||
RUST_LOG=DEBUG cargo run --release --bin engine -- \
|
||||
--metadata-path crates/open-dds/examples/reference.json \
|
||||
--authn-config-path auth_config.json
|
||||
--authn-config-path static/auth/auth_config.json
|
||||
```
|
||||
|
||||
A dev webhook implementation is provided in `crates/auth/dev-auth-webhook`, that
|
||||
@ -81,7 +81,7 @@ You can also start v3-engine, along with a Postgres data connector and Jaeger
|
||||
for tracing using Docker:
|
||||
|
||||
```sh
|
||||
METADATA_PATH=crates/engine/tests/schema.json AUTHN_CONFIG_PATH=auth_config.json docker compose up
|
||||
METADATA_PATH=crates/engine/tests/schema.json AUTHN_CONFIG_PATH=static/auth/auth_config.json docker compose up
|
||||
```
|
||||
|
||||
Open <http://localhost:3001> for GraphiQL, or <http://localhost:4002> to view
|
||||
@ -220,7 +220,7 @@ v3-engine run with the chinook database as a data connector.
|
||||
To get this running, you can run the following command:
|
||||
|
||||
```bash
|
||||
METADATA_PATH=crates/engine/tests/schema.json AUTHN_CONFIG_PATH=auth_config.json docker compose up postgres_connector engine
|
||||
METADATA_PATH=crates/engine/tests/schema.json AUTHN_CONFIG_PATH=static/auth/auth_config.json docker compose up postgres_connector engine
|
||||
```
|
||||
|
||||
### Running tests with a single command
|
||||
|
@ -148,7 +148,7 @@ mod tests {
|
||||
let mut path_buf = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
path_buf.pop();
|
||||
path_buf.pop();
|
||||
path_buf.join("auth_config.json")
|
||||
path_buf.join("static/auth/auth_config.json")
|
||||
};
|
||||
let auth_config_from_json = <super::AuthConfig as open_dds::traits::OpenDd>::deserialize(
|
||||
serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap(),
|
||||
|
@ -21,7 +21,7 @@ services:
|
||||
auth_hook:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- ./auth_config.json:/app/auth_config.json
|
||||
- ./static/auth/auth_config.json:/app/auth_config.json
|
||||
- ./crates/engine/tests/schema.json:/app/crates/engine/tests/schema.json
|
||||
- ./crates/open-dds/examples/reference.json:/app/crates/open-dds/examples/reference.json
|
||||
|
||||
|
@ -33,7 +33,7 @@ run-local-with-shell:
|
||||
cargo run --bin dev-auth-webhook | ts "dev-auth-webhook:" &
|
||||
RUST_LOG=DEBUG cargo run --bin engine -- \
|
||||
--otlp-endpoint http://localhost:4317 \
|
||||
--authn-config-path auth_config.json \
|
||||
--authn-config-path static/auth/auth_config.json \
|
||||
--metadata-path crates/engine/tests/schema.json \
|
||||
--expose-internal-errors | ts "engine: " &
|
||||
wait
|
||||
@ -78,7 +78,7 @@ watch: start-docker-test-deps start-docker-run-deps
|
||||
-x 'clippy --no-deps' \
|
||||
-x 'run --bin engine -- \
|
||||
--otlp-endpoint http://localhost:4317 \
|
||||
--authn-config-path auth_config.json \
|
||||
--authn-config-path static/auth/auth_config.json \
|
||||
--metadata-path crates/engine/tests/schema.json \
|
||||
--expose-internal-errors'
|
||||
|
||||
@ -134,7 +134,7 @@ update-custom-connector-schema-in-test-metadata: && fix-format
|
||||
run: start-docker-test-deps start-docker-run-deps
|
||||
RUST_LOG=DEBUG cargo run --bin engine -- \
|
||||
--otlp-endpoint http://localhost:4317 \
|
||||
--authn-config-path auth_config.json \
|
||||
--authn-config-path static/auth/auth_config.json \
|
||||
--metadata-path crates/engine/tests/schema.json \
|
||||
--expose-internal-errors
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
[
|
||||
{
|
||||
"version": "v1",
|
||||
"definition": {
|
||||
"name": "example",
|
||||
"url": "http://localhost:5000/allow_list",
|
||||
"request": {
|
||||
"headers": false,
|
||||
"session": true,
|
||||
"rawRequest": {
|
||||
"query": true,
|
||||
"variables": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
11
v3/static/auth/auth_config_v2.json
Normal file
11
v3/static/auth/auth_config_v2.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": "v2",
|
||||
"definition": {
|
||||
"mode": {
|
||||
"webhook": {
|
||||
"url": "http://auth_hook:3050/validate-request",
|
||||
"method": "Post"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user