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

v2: Complete app refactor #39

Merged
merged 78 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
1c8ff9f
Complete re-do app
diogosilva30 Oct 23, 2022
b56ee03
Make middleware async capable
diogosilva30 Oct 23, 2022
f806de7
Add missing return
diogosilva30 Oct 23, 2022
00946e3
Add method to check info based on decoded token
diogosilva30 Oct 23, 2022
5d8184b
Remove return statement from middleware
diogosilva30 Oct 23, 2022
9fac107
Improve error handling
diogosilva30 Oct 24, 2022
6c42008
Fix user creation
diogosilva30 Oct 24, 2022
dbfad07
Fix error in getting client roles
diogosilva30 Oct 24, 2022
2bef36d
Simplify Authentication, Add basic auth support, reduce token API calls
diogosilva30 Oct 24, 2022
7354dcf
Set bearer token to dummy value in case of failed basic auth
diogosilva30 Oct 24, 2022
839563d
Improve Settings module
diogosilva30 Oct 25, 2022
1ce6151
Fix Circular import errors
diogosilva30 Oct 25, 2022
19a94d3
Fix Error msg format
diogosilva30 Oct 25, 2022
1da3ee8
Update token and settins handling
moritz89 Oct 25, 2022
c52502a
Fix bugs in Token
moritz89 Oct 25, 2022
162bbcd
Merge branch and fix circular imports
diogosilva30 Oct 25, 2022
7c2980e
Simplify configs parsing
diogosilva30 Oct 25, 2022
e1c2650
Fix None Variables Parsing
diogosilva30 Oct 25, 2022
64a4f4c
Change Superuser to property, remove graphene middleware
diogosilva30 Oct 25, 2022
8c3e0d8
Remove validation auth header
diogosilva30 Oct 25, 2022
79e58f7
Back to token properties
diogosilva30 Oct 25, 2022
fd27187
Prepare for poetry packaging
moritz89 Aug 23, 2022
dfb59a3
Add CI test config
moritz89 Oct 10, 2022
abece85
Update Keycloak docker image URL
moritz89 Oct 10, 2022
3cdd42f
Fix image name
moritz89 Oct 10, 2022
0431749
Remove options
moritz89 Oct 10, 2022
4c35d78
Try legacy Docker image
moritz89 Oct 11, 2022
7db7a7a
Import realms to Keycloak
moritz89 Oct 11, 2022
fe2b0cc
Add debug to start script
moritz89 Oct 11, 2022
92a36c9
Debug keycloak import
moritz89 Oct 11, 2022
c00d461
Add env options to keycloak docker
moritz89 Oct 11, 2022
7072c70
Hardcode KC credentials
moritz89 Oct 11, 2022
868c898
Enable cache in Github action
moritz89 Oct 11, 2022
c009b33
Test env variables
moritz89 Oct 11, 2022
6949048
Test env variables 2
moritz89 Oct 11, 2022
eb76a70
Test env variables 3
moritz89 Oct 11, 2022
2de424f
Test env variables 4
moritz89 Oct 11, 2022
4b97438
Revert env variable test
moritz89 Oct 11, 2022
a2267df
Test keycloak tag matrix
moritz89 Oct 11, 2022
48713c1
Expand keycloak tags, reduce Python tags
moritz89 Oct 11, 2022
8ce3548
Update cache key with lock hash
moritz89 Oct 11, 2022
d288862
Update cache config
moritz89 Oct 11, 2022
bb75377
Test cache changes
moritz89 Oct 11, 2022
b5711fc
Undo optimizations
moritz89 Oct 11, 2022
9ced194
Fix package version
moritz89 Oct 21, 2022
b1600c9
Added tests with Python 3.7 and 3.9 and Keycloak latest major version…
simao-silva Oct 23, 2022
af22b1d
Add urls to test middleware
moritz89 Oct 26, 2022
fed46f2
Fix package src location
moritz89 Oct 26, 2022
6fcde4a
Remove setup and teardown from test mixin
diogosilva30 Oct 26, 2022
a16e0ba
Update poetry.lock
moritz89 Oct 26, 2022
7a4acaf
Remove setup and teardown
diogosilva30 Oct 26, 2022
eaabd71
Merge branch 'v2-complete-redo' of https://github.com/urbanplatform/d…
diogosilva30 Oct 26, 2022
3902f47
Upgrade GitHub action cache step to v3
moritz89 Oct 26, 2022
4938a10
Improve config parsing
diogosilva30 Oct 26, 2022
a3979f7
Merge branch 'v2-complete-redo' of https://github.com/urbanplatform/d…
diogosilva30 Oct 26, 2022
e72f410
Remove deprecated graphql related stuff
diogosilva30 Oct 26, 2022
5795e8c
Add "create_user_on_keycloak" method
diogosilva30 Oct 26, 2022
4768a9f
Fix Mixin
diogosilva30 Oct 26, 2022
aab6839
Fix Tests
diogosilva30 Oct 26, 2022
22b4260
Fix Mixin
diogosilva30 Oct 26, 2022
0127a8b
Fix tests
moritz89 Oct 27, 2022
641ae08
Add logging for token handling
moritz89 Oct 27, 2022
5379dda
Added tests with Python 3.11 and removed parallel restriction
simao-silva Oct 27, 2022
d880f2b
Only connect to server if auth system is keycloak
diogosilva30 Oct 27, 2022
a142965
Merge branch 'v2-complete-redo' of https://github.com/urbanplatform/d…
diogosilva30 Oct 27, 2022
ba8c0ee
Fix Circular import
diogosilva30 Oct 27, 2022
54ee49c
Change admin connection to lazy instance
diogosilva30 Oct 27, 2022
7bc11e3
Update test to lazy connector
diogosilva30 Oct 27, 2022
7a44d4d
Update connector place
diogosilva30 Oct 27, 2022
24486d0
Update connector
diogosilva30 Oct 27, 2022
c32c78c
Add docs for backend
diogosilva30 Oct 27, 2022
3908c51
Add lazy loaded KeycloakAdmin
moritz89 Oct 27, 2022
99bf549
Add authentication test
moritz89 Oct 28, 2022
164d24e
Improve Docs
diogosilva30 Oct 28, 2022
fca3b62
Fix Typo
diogosilva30 Oct 28, 2022
b191719
Fix Typo
diogosilva30 Oct 28, 2022
4f8cb8e
merge
diogosilva30 Oct 28, 2022
882c463
Simplify Expression
diogosilva30 Oct 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Run CI tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
env:
KEYCLOAK_HOST: localhost
KEYCLOAK_PORT: 8080
KEYCLOAK_ADMIN_USER: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KEYCLOAK_REALM: test-realm
KEYCLOAK_CLIENT_ID: test-client
KEYCLOAK_CLIENT_SECRET_KEY: f6974574-c773-4554-826d-06946cd55e98
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
keycloak-tag:
[
"13.0.1",
"14.0.0",
"15.1.1",
"16.1.1",
"17.0.1-legacy",
"18.0.2-legacy",
"19.0.3-legacy",
]

services:
keycloak:
image: quay.io/keycloak/keycloak:${{ matrix.keycloak-tag }}
ports:
- 8080:8080
- 9990:9990
options: >-
-e "KEYCLOAK_USER=admin"
-e "KEYCLOAK_PASSWORD=admin"

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up the cache
uses: actions/cache@v3
env:
cache-name: cache-python-packages
with:
path: .venv
key: poetry-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}

- name: Set up the project
run: |
pip install poetry
poetry config virtualenvs.in-project true
poetry install

- name: Test with pytest
run: ./tests/start.sh
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ This package should only be used in projects starting from scratch, since it ove
'CLIENT_ADMIN_ROLE': '<CLIENT_ADMIN_ROLE>',
'REALM_ADMIN_ROLE': '<REALM_ADMIN_ROLE>',
'EXEMPT_URIS': [], # URIS to be ignored by the package
'GRAPHQL_ENDPOINT': 'graphql/' # Default graphQL endpoint
}
```

Expand All @@ -51,9 +50,7 @@ This package should only be used in projects starting from scratch, since it ove
AUTH_USER_MODEL = "django_keycloak.KeycloakUserAutoId"
```

7. If you are using Graphene, add the `GRAPHQL_ENDPOINT` to settings and `KeycloakGrapheneMiddleware` to the Graphene's `MIDDLEWARE`.

8. Configure Django-Rest-Framework authentication classes with `django_keycloak.authentication.KeycloakAuthentication`:
7. Configure Django-Rest-Framework authentication classes with `django_keycloak.authentication.KeycloakAuthentication`:

```python
REST_FRAMEWORK = {
Expand Down
27 changes: 0 additions & 27 deletions django_keycloak/api/serializers.py

This file was deleted.

64 changes: 0 additions & 64 deletions django_keycloak/authentication.py

This file was deleted.

46 changes: 0 additions & 46 deletions django_keycloak/backends.py

This file was deleted.

20 changes: 0 additions & 20 deletions django_keycloak/decorators.py

This file was deleted.

5 changes: 0 additions & 5 deletions django_keycloak/enums.py

This file was deleted.

8 changes: 0 additions & 8 deletions django_keycloak/errors.py

This file was deleted.

Loading