-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vdk-plugins: Introduce vdk-control-api-auth plugin (#801)
With the increase in plugins requiring authentication arises the need for a dedicated utility that provides such functions. This change introduces the initial structure of a library plugin, whose purpose is to facilitate authentication with 3-rd party services. Testing Done: None Signed-off-by: Andon Andonov <[email protected]>
- Loading branch information
Showing
6 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2021 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
image: "python:3.7" | ||
|
||
# TODO: Uncomment when committing new changes | ||
#.build-vdk-control-api-auth: | ||
# variables: | ||
# PLUGIN_NAME: vdk-control-api-auth | ||
# extends: .build-plugin | ||
# | ||
#build-py37-vdk-control-api-auth: | ||
# extends: .build-vdk-control-api-auth | ||
# image: "python:3.7" | ||
# | ||
# | ||
#build-py38-vdk-control-api-auth: | ||
# extends: .build-vdk-control-api-auth | ||
# image: "python:3.8" | ||
# | ||
# | ||
#build-py39-vdk-control-api-auth: | ||
# extends: .build-vdk-control-api-auth | ||
# image: "python:3.9" | ||
# | ||
#build-py310-vdk-control-api-auth: | ||
# extends: .build-vdk-control-api-auth | ||
# image: "python:3.10" | ||
|
||
# TODO: Uncomment when plugin is ready for release | ||
#release-vdk-control-api-auth: | ||
# variables: | ||
# PLUGIN_NAME: vdk-control-api-auth | ||
# extends: .release-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# vdk-control-api-auth | ||
|
||
vdk-control-api-auth is a plugin library that implements authentication | ||
utilities used by vdk-control-cli and other plugins. | ||
|
||
## Usage | ||
|
||
This is a library plugin, not a runnable plugin, and it is intended to be | ||
used as a dependency for other plugins which need to authenticate users. | ||
|
||
## Build and testing | ||
|
||
In order to build and test a plugin go to the plugin directory and use `../build-plugin.sh` script to build it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pytest | ||
vdk-core | ||
|
||
vdk-test-utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright 2021 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import pathlib | ||
|
||
import setuptools | ||
|
||
""" | ||
Builds a package with the help of setuptools in order for this package to be imported in other projects | ||
"plugin-package-template" is the name of the package which contains the plugin/s. | ||
"plugin-template" is the name of the plugin contained within this package. Note that you can include | ||
more than one plugin in a single package. Also note that the contained plugin may have the same name as the package. | ||
"plugin_template" is the Python file which contains the plugin hooks for the corresponding plugin. | ||
""" | ||
|
||
__version__ = "0.1.0" | ||
|
||
setuptools.setup( | ||
name="vdk-control-api-auth", | ||
version=__version__, | ||
url="https://github.com/vmware/versatile-data-kit", | ||
description="Versatile Data Kit plugin library provides support for " | ||
"authentication.", | ||
long_description=pathlib.Path("README.md").read_text(), | ||
long_description_content_type="text/markdown", | ||
install_requires=[], | ||
package_dir={"": "src"}, | ||
packages=setuptools.find_namespace_packages(where="src"), | ||
entry_points={ | ||
"vdk.plugin.run": [ | ||
"vdk-control-api-auth = vdk.plugin.control_api_auth.control_api_auth_plugin" | ||
] | ||
}, | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
], | ||
) |
13 changes: 13 additions & 0 deletions
13
...k-plugins/vdk-control-api-auth/src/vdk/plugin/control_api_auth/control_api_auth_plugin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2021 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from vdk.api.plugin.hook_markers import hookimpl | ||
|
||
""" | ||
Include the plugin hooks here. For example: | ||
from vdk.internal.core.context import CoreContext | ||
@hookimpl | ||
def vdk_initialize(context: CoreContext): | ||
pass | ||
""" |
2 changes: 2 additions & 0 deletions
2
projects/vdk-plugins/vdk-control-api-auth/tests/test_vdk_auth_plugin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Copyright 2021 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 |