diff options
author | John Estabrook <jestabro@vyos.io> | 2022-10-23 11:07:16 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2022-10-25 10:35:48 -0500 |
commit | f76a6f68b08fce1feee2dbbb84658b8eede09655 (patch) | |
tree | 013baed425a22f499ac1a50ffd7c119247ed265d /src/services/api/graphql/bindings.py | |
parent | cbb72ad6d3f5f08ad23c40e29b9463087ca5cade (diff) | |
download | vyos-1x-f76a6f68b08fce1feee2dbbb84658b8eede09655.tar.gz vyos-1x-f76a6f68b08fce1feee2dbbb84658b8eede09655.zip |
graphql: T4574: add mutation for requesting JWT token
Diffstat (limited to 'src/services/api/graphql/bindings.py')
-rw-r--r-- | src/services/api/graphql/bindings.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/services/api/graphql/bindings.py b/src/services/api/graphql/bindings.py index d3cff21c7..aa1ba0eb0 100644 --- a/src/services/api/graphql/bindings.py +++ b/src/services/api/graphql/bindings.py @@ -18,9 +18,12 @@ from . graphql.queries import query from . graphql.mutations import mutation from . graphql.directives import directives_dict from . graphql.errors import op_mode_error +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(): @@ -30,8 +33,11 @@ def generate_schema(): 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 |