feat: v2 auth passport cross tenant - #567
Draft
nikola-maric-aula wants to merge 103 commits into
Draft
Conversation
nikola-maric-aula
force-pushed
the
feat/v2-auth-passport-cross-tenant
branch
from
August 6, 2026 14:08
0cac83c to
d0e4c11
Compare
- TODO: rename it and fix other tests too
- also, chore: updated composer.lock - also, fix: .editorconfig forces composer.lock to indent_size=4 which should help avoid misaligned indentation when doing manual git merge conflict resolution in the lockfile and when using composer install (which defaults to 4 spaces)
| $driver = Socialite::driver('keycloak'); | ||
| /** @var SocialiteOAuth2User $socialiteUser */ | ||
| $socialiteUser = $driver->stateless()->user(); | ||
| $socialiteUser = Socialite::driver('keycloak')->stateless()->user(); |
nikola-maric-aula
force-pushed
the
feat/v2-auth-passport-cross-tenant
branch
from
August 13, 2026 15:15
955b1f0 to
9ba3d36
Compare
bikubi
reviewed
Aug 18, 2026
| xdebug-v2-docker-setup: | ||
| docker compose exec aula-backend.v2 true | ||
| docker compose exec aula-backend.v2 sh -c 'apk add php84-pecl-xdebug; echo -e "zend_extension=/usr/lib/php84/modules/xdebug.so\nxdebug.mode=develop,debug\nxdebug.start_with_request=yes\nxdebug.client_host=host.docker.internal\nxdebug.client_port=9013\ndefault_socket_timeout=600" > /usr/local/etc/php/conf.d/docker-xdebug.ini' | ||
| docker compose exec aula-backend.v2 sh -c 'composer require --dev -m phpunit/phpunit ^12' |
Contributor
There was a problem hiding this comment.
This doesn't work for me ootb because post-update-cmd fails to write to .ide_helpers. I think IDE helpers within the container don't make much sense; maybe move it from implicit cmd to an explicit composer script to be run on demand (as well as depending on dev's IDE needs)?
7 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
In BE v1 we use custom JWT for auth. The new Access+Refresh tokens follow OAuth2.0 spec and are using industry-standard Laravel Passport library. It comes with full revocation, expiry, purging, refreshing and other standardized behavior.
Frontend needs to adapt to using this v2 authN, but since it's standardized approach, it should be simple by using some OAuth2.0 library.
Implementation details
CentralClientinstead of the defaultPassportClient. OurCentralClientis fixed to work with the central (manager) database, while all other operations over the database during authN (like checking User credentials) happen in multi-tenancy-context of a single tenant. This enables the Mobile Apps to use a single shared Client for all Tenants. The HTTP Header "aula-instance-code" still determines the Tenant for logging in the user.TODOs
oauth-public.keyExample usage
edit your
.envfile and update the variableDB_CONNECTION=mariadb_central(same as in the new.env.example)inside the running v2 container (truncated the output for conciseness):
Then attempt using access token of Guest user:
Then using access token of Admin user:
Then using refresh token of Admin user:
If we now try to use the old access token of Admin user, it has been revoked:
But the new access token works.
Checklist