Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement restapi services to handle authentication flow #39

Merged
merged 13 commits into from
Nov 23, 2023
Merged
2 changes: 1 addition & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ codespell_skip = "*.min.js,*.pot,*.po,*.yaml,*.json"
codespell_ignores = "vew"
dependencies_ignores = "['plone.restapi', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest', 'pytest-cov', 'pytest-plone', 'pytest-docker', 'pytest-vcr', 'pytest-mock', 'gocept.pytestlayer', 'requests-mock', 'vcrpy']"
dependencies_mappings = [
"Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Products.PluggableAuthService']",
"Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Products.PluggableAuthService', 'Products.PlonePAS']",
]
check_manifest_ignores = """
"news/*",
Expand Down
36 changes: 36 additions & 0 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,36 @@ Then install the dependencies and a development instance using:
```bash
make build
ericof marked this conversation as resolved.
Show resolved Hide resolved
```

### Start Local Server

Start Plone, on port 8080, with the command:

```bash
make start
```

#### Keycloak

The `pas.plugins.oidc` repository has a working setup for a `Keycloak` development server using `Docker` and `Docker Compose`. To use it, in a terminal, run the command:

```bash
make keycloak-start
```

There are two realms configured `plone` and `plone-test`. The later is used in automated tests, while the former should be used for your development environment.

ericof marked this conversation as resolved.
Show resolved Hide resolved
The `plone` realm ships with an user that has the following credentials:

* username: **user**
* password: **12345678**

To stop a running `Keycloak` (needed when running tests), use:

```bash
make keycloak-stop
```

### Update translations

```bash
Expand Down Expand Up @@ -34,3 +64,9 @@ Run all tests but stop on the first error and open a `pdb` session:
```bash
./bin/tox -e test -- -x --pdb
```

Run tests named `TestServiceOIDCPost`:

```bash
./bin/tox -e test -- -k TestServiceOIDCPost
```
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RESET=`tput sgr0`
YELLOW=`tput setaf 3`

BACKEND_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
COMPOSE_FOLDER=${BACKEND_FOLDER}/tests
DOCS_DIR=${BACKEND_FOLDER}/docs

# Python checks
Expand Down Expand Up @@ -128,6 +129,22 @@ test: bin/tox ## run tests
test-coverage: bin/tox ## run tests
bin/tox -e coverage

# Keycloak
.PHONY: keycloak-start
keycloak-start: ## Start Keycloak stack
@echo "$(GREEN)==> Start keycloak stack$(RESET)"
@docker compose -f $(COMPOSE_FOLDER)/docker-compose.yml up -d

.PHONY: keycloak-status
keycloak-status: ## Check Keycloak stack status
@echo "$(GREEN)==> Check Keycloak stack status$(RESET)"
@docker compose -f $(COMPOSE_FOLDER)/docker-compose.yml ps

.PHONY: keycloak-stop
keycloak-stop: ## Stop Keycloak stack
@echo "$(GREEN)==> Stop Keycloak stack$(RESET)"
@docker compose -f $(COMPOSE_FOLDER)/docker-compose.yml down

# Docs
bin/sphinx-build: bin/pip
bin/pip install -r requirements-docs.txt
Expand Down
1 change: 1 addition & 0 deletions news/38.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement restapi services to handle authentication flow [@ericof]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Zope = [
]
python-dateutil = ['dateutil']
ignore-packages = ['plone.restapi', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest', 'pytest-cov', 'pytest-plone', 'pytest-docker', 'pytest-vcr', 'pytest-mock', 'gocept.pytestlayer', 'requests-mock', 'vcrpy']
Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Products.PluggableAuthService']
Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Products.PluggableAuthService', 'Products.PlonePAS']

##
# Add extra configuration options in .meta.toml:
Expand Down
1 change: 1 addition & 0 deletions src/pas/plugins/oidc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


PACKAGE_NAME = "pas.plugins.oidc"
PLUGIN_ID = "oidc"

_ = MessageFactory(PACKAGE_NAME)

Expand Down
Loading