You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custodia has plugins for store, authn and authz but no plugins to modify the behavior of custodia.cli. Rather than baking features like #238 directly into the CLI, Custodia should have an API to allow customization of CLI. I'm thinking about a similar approach as https://docs.pytest.org/en/latest/writing_plugins.html
Any package can provide a CLI plugin as custodia.cli entry point.
API draft
classCustodiaCLIPlugin(object):
name='gssapi'priority=100title='GSSAPI authentication'description=Nonedef__init__(self, parser, subparsers):
"""Init :param parser: argparse Parser instance :param subparsers: subparser instance """self.parser=parserself.subparsers=subparsersdefadd_arguments(self):
"""Add argparse arguments :param group: argparse Parser group :return: None """group=self.parser.add_argument_group(
self.title, self.description
)
group.add_argument(
'--gssapi', action='store_true',
help='Use Negotiate / GSSAPI auth'
)
defvalidate_arguments(self, args):
"""Validate arguments after parsing :param args: namespace from parser.parse_args(...) :return: None """ifargs.gssapiandargs.certfile:
self.parser.error(
"gssapi and certfile are mutually exclusive.\n"
)
ifargs.gssapiandrequests_gssapiisNone:
self.parser.error(
"'requests_gssapi' package is not available! You can ""install it with: 'pip install custodia[gssapi]'.\n"
)
defcreate_client(self, args):
"""Create custodia client instance Plugins are sorted by priority and name. The first plugin that returns a client instance wins. :param args: namespace from parser.parse_args(...) :return: None or instance of CustodiaHTTPClient subclass """defupdate_client(self, args, client):
"""Update client with settings :param args: namespace from parser.parse_args(...) :param client: Custodia client instance :return: """ifargs.gssapi:
client.set_gssapi_auth()
The text was updated successfully, but these errors were encountered:
Custodia has plugins for store, authn and authz but no plugins to modify the behavior of
custodia.cli
. Rather than baking features like #238 directly into the CLI, Custodia should have an API to allow customization of CLI. I'm thinking about a similar approach as https://docs.pytest.org/en/latest/writing_plugins.htmlAny package can provide a CLI plugin as
custodia.cli
entry point.API draft
The text was updated successfully, but these errors were encountered: