diff options
author | John Estabrook <jestabro@vyos.io> | 2022-10-25 12:08:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 12:08:42 -0500 |
commit | 1265b15ffc8baa05177c707f30205d70528c5dc6 (patch) | |
tree | 8cb9715666250f8599147d066bd93a9a06df4962 /src/services/api/graphql/bindings.py | |
parent | ec82d60828500a56b6fe8357970bf839053ac0af (diff) | |
parent | 3db5ba8ef354d80f080cc1baacf33d77ccbb6222 (diff) | |
download | vyos-1x-1265b15ffc8baa05177c707f30205d70528c5dc6.tar.gz vyos-1x-1265b15ffc8baa05177c707f30205d70528c5dc6.zip |
Merge pull request #1613 from jestabro/graphql-hybrid-auth
graphql: T4574: add JWT token authentication
Diffstat (limited to 'src/services/api/graphql/bindings.py')
-rw-r--r-- | src/services/api/graphql/bindings.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/services/api/graphql/bindings.py b/src/services/api/graphql/bindings.py index 0b1260912..aa1ba0eb0 100644 --- a/src/services/api/graphql/bindings.py +++ b/src/services/api/graphql/bindings.py @@ -18,16 +18,26 @@ from . graphql.queries import query from . graphql.mutations import mutation from . graphql.directives import directives_dict from . graphql.errors import op_mode_error -from . utils.schema_from_op_mode import generate_op_mode_definitions +from . graphql.auth_token_mutation import auth_token_mutation +from . generate.schema_from_op_mode import generate_op_mode_definitions +from . generate.schema_from_config_session import generate_config_session_definitions +from . generate.schema_from_composite import generate_composite_definitions +from . libs.token_auth import init_secret +from . import state from ariadne import make_executable_schema, load_schema_from_path, snake_case_fallback_resolvers def generate_schema(): api_schema_dir = vyos.defaults.directories['api_schema'] generate_op_mode_definitions() + generate_config_session_definitions() + generate_composite_definitions() + + if state.settings['app'].state.vyos_auth_type == 'token': + init_secret() type_defs = load_schema_from_path(api_schema_dir) - schema = make_executable_schema(type_defs, query, op_mode_error, mutation, snake_case_fallback_resolvers, directives=directives_dict) + schema = make_executable_schema(type_defs, query, op_mode_error, mutation, auth_token_mutation, snake_case_fallback_resolvers, directives=directives_dict) return schema |