-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e6fd8bf
Showing
13 changed files
with
555 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,58 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
- 'release/**' | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
- 'release/**' | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up environment | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Set Version number | ||
if: github.ref != 'refs/heads/main' && github.event_name == 'push' | ||
run: | | ||
branchId="${GITHUB_REF/refs\/heads\/release\//}" | ||
buildNumber="${branchId}.${GITHUB_RUN_NUMBER}" | ||
echo $branchId $buildNumber | ||
sed "s/0.0.0/${buildNumber}/g" ./localstack_extension/VERSION -i | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
# python3 -m pip install --upgrade localstack==2.2.0 | ||
make install | ||
# pip3 install -r requirements.txt | ||
- name: Build deployable | ||
run: | | ||
python3 -m pip install build --user | ||
python3 -m build --sdist --wheel --outdir dist/ . | ||
- name: Deploy package to package repository | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: github.ref != 'refs/heads/main' && github.event_name == 'push' | ||
with: | ||
print_hash: true | ||
|
||
- name: Tag and release version | ||
if: github.ref != 'refs/heads/main' && github.event_name == 'push' | ||
run: | | ||
git tag ${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER | ||
git push origin ${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER |
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,135 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# IDE files | ||
.idea | ||
.vscode | ||
|
||
node_modules/ |
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,39 @@ | ||
VENV_BIN = python3 -m venv | ||
VENV_DIR ?= .venv | ||
VENV_ACTIVATE = $(VENV_DIR)/bin/activate | ||
VENV_RUN = . $(VENV_ACTIVATE) | ||
|
||
venv: $(VENV_ACTIVATE) | ||
|
||
$(VENV_ACTIVATE): setup.py setup.cfg | ||
test -d .venv || $(VENV_BIN) .venv | ||
$(VENV_RUN); pip install --upgrade pip setuptools plux | ||
$(VENV_RUN); pip install --upgrade black isort pyproject-flake8 flake8-black flake8-isort | ||
$(VENV_RUN); pip install -e . | ||
touch $(VENV_DIR)/bin/activate | ||
|
||
clean: | ||
rm -rf .venv/ | ||
rm -rf build/ | ||
rm -rf .eggs/ | ||
rm -rf *.egg-info/ | ||
|
||
install: venv | ||
$(VENV_RUN); python setup.py develop | ||
|
||
lint: ## Run code linter to check code style | ||
($(VENV_RUN); python -m pflake8 --show-source) | ||
|
||
format: ## Run black and isort code formatter | ||
$(VENV_RUN); python -m isort .; python -m black . | ||
|
||
dist: venv | ||
$(VENV_RUN); python setup.py sdist bdist_wheel | ||
|
||
publish: clean-dist venv dist | ||
$(VENV_RUN); pip install --upgrade twine; twine upload dist/* | ||
|
||
clean-dist: clean | ||
rm -rf dist/ | ||
|
||
.PHONY: clean clean-dist dist install publish |
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,51 @@ | ||
|
||
<p align="center"> | ||
<img src="https://github.com/Authress/authress-local/assets/5056218/156e3881-b359-4810-bc96-7abeaf9ddbdb" height="300px" alt="Authress Media Banner"> | ||
</p> | ||
|
||
# LocalStack Extension for Authress Authentication and Authorization | ||
|
||
This is the LocalStack extension that enables running authentication, user identity, permissions, api key management, and access control in your LocalStack environment via [Authress](https://authress.io). | ||
|
||
This LocalStack extension generates a copy of the [Authress API](https://authress.io/app/#/api) so that the authentication and access management the Authress API provides can be utilized by running services directly in any environment. You can use this to build authentication and authorization directly into your applications and services. Additionally, this extension can be used locally to develop faster without needing an [Authress Account](https://authress.io). | ||
|
||
<p align="center"> | ||
<a href="https://badge.fury.io/py/localstack-extension-authress" alt="LocalStack Authress Extension"> | ||
<img src="https://badge.fury.io/py/localstack-extension-authress.svg"> | ||
</a> | ||
<a href="https://github.com/Authress/localstack-extension/actions/workflows/build.yml" alt="Build status"> | ||
<img src="https://github.com/Authress/localstack-extension/actions/workflows/build.yml/badge.svg"> | ||
</a> | ||
<a href="https://github.com/Authress/localstack-extension/blob/main/LICENSE" alt="Apache-2.0"> | ||
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"> | ||
</a> | ||
<a href="https://authress.io/community" alt="authress community"> | ||
<img src="https://img.shields.io/badge/Community-Authress-fbaf0b.svg"> | ||
</a> | ||
</p> | ||
|
||
=============================== | ||
|
||
## Installation | ||
|
||
To install the Authentication & Authorization extension into LocalStack, run | ||
```sh | ||
localstack extensions install localstack-extension-authress | ||
``` | ||
|
||
## Usage | ||
The auth extension runs at `http://authress.localhost.localstack.cloud:8888`. | ||
|
||
You can configure API calls to the authorization server by passing this url as the `authressApiUrl` or the `authress_api_url` depending on which SDK you are using. | ||
|
||
|
||
```ts | ||
import { AuthressClient } from 'authress-sdk'; | ||
const authressClient = new AuthressClient({ authressApiUrl: `http://authress.localhost.localstack.cloud:8888` }); | ||
await authressClient.userPermissions.authorizeUser(userId, resourceUri, permission); | ||
``` | ||
|
||
|
||
## Contribution Guide | ||
|
||
[Developing for the LocalStack Authress Extension](https://github.com/Authress/localstack-extension/blob/main/contributing.md) |
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,32 @@ | ||
# Contributing to this LocalStack Extension | ||
|
||
## Setup | ||
```sh | ||
|
||
pip install flake8 pytest | ||
pip3 install -r requirements.txt -r test-requirements.txt | ||
``` | ||
|
||
### Install local development version | ||
|
||
To install the Authentication & Authorization extension into LocalStack in developer mode, you will need Python 3.10, and create a virtual environment in the extensions project. | ||
|
||
In the newly generated project, run: | ||
|
||
<!-- | ||
Support (Beta) version of localstack auth command | ||
```bash | ||
mkdir -p ~/.localstack | ||
echo '{"token":true}' > ~/.localstack/auth.json | ||
``` | ||
--> | ||
|
||
```bash | ||
cd localstack-extensions/authress | ||
python -m pip install --upgrade pip | ||
python3 -m pip install --upgrade localstack==2.2.0 | ||
make install | ||
localstack extensions dev enable . | ||
EXTENSION_DEV_MODE=1 localstack start | ||
``` |
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 @@ | ||
0.0.0 |
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 @@ | ||
name = "localstack-extension-authress" |
Oops, something went wrong.