-
Notifications
You must be signed in to change notification settings - Fork 3
feat: v2 auth passport cross tenant #567
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
Draft
nikola-maric-aula
wants to merge
103
commits into
main
Choose a base branch
from
feat/v2-auth-passport-cross-tenant
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 102 commits
Commits
Show all changes
103 commits
Select commit
Hold shift + click to select a range
d94e914
implement v2 user, wip
bikubi 7e6e92b
chore: Nikola's comments
nikola-maric-aula 96f4d5f
wip
bikubi 94594d7
try domain model
bikubi cf71d1c
more wip
bikubi 02a4b3e
more cleanup, refactor UserStatus everywhere
bikubi 9fa5681
Merge branch 'main' into v2-user
bikubi 41560ee
implement "input dto"s via rule inheritance
bikubi 1478fc5
use constructors in UseCases
bikubi ce59890
avoid empty LegacyUser
bikubi f862a22
cleanup
bikubi 8a0cdb4
use hash_id over id
bikubi ea58793
readonly UserData
bikubi e5761bb
pluralize endpoint
bikubi 055466a
fix readonly UserData
bikubi ad2c191
disallow PATCH
bikubi 17a336a
output created
bikubi dd06f82
missing uses
bikubi 22e9a27
require laravel-data
bikubi 6610fe4
implement Optional properties abstractly
bikubi 4bca298
fix-suppress psalm errors
bikubi 36e168a
strictify + cleanup
bikubi e656bc0
prohibit update/store of created
bikubi d55c55a
test (hash)id properly
bikubi 995057a
restructure crud test
bikubi 22d4263
improve tests
bikubi aacaed3
"prohibit" other props in request
bikubi e8a41b0
add todo
bikubi c19cb96
Merge branch 'main' into v2-user-abstract
bikubi 1b9869e
output last_update/updatedAt
bikubi 21605bf
docs
bikubi 5a2a187
remove attempt without laravel-data, using vanilla Resource + Requests
bikubi 75e60c4
get rid of Optional, use nullable
bikubi f9205eb
fix controller dependency injection
bikubi 6c91324
validate route param user/uuid
bikubi c4db598
fix: user public ids are not uuids
bikubi 3be92db
fix patch disallowed test
bikubi 62a5c3a
normalize names of created&updatedAt
bikubi acc1158
remove id from user data objects
bikubi 4cdf06e
rename hashId to publicId
bikubi 18b2aa1
404 if instancecode/tenant header not set
bikubi bbfd72b
ref: renaming classes and inner cosmetics
nikola-maric-aula c736623
chore: update .env.testing for various setups
nikola-maric-aula 1de7f25
chore: some merge/rebase fixups
nikola-maric-aula f144df8
feat: use hash_id from the jwt in LegacyJwtMiddleware
nikola-maric-aula 8baeb56
docs: controllers in our clean code setup
nikola-maric-aula a2adf48
Merge branch 'main' of github.com:aula-app/aula-backend into v2-user-…
nikola-maric-aula b913579
fix .env.testing for local (vscode) setup
bikubi d0024f5
fix legacy auth test
bikubi 4912fe1
fix sso test WIP
bikubi 7b55f77
fix removed column
bikubi 0fb1973
fix more id->hash usage
bikubi a3ea923
implement authn+authz for /api/v2/users via legacy/jwt middleware
bikubi 9145188
use LegacyJwtGuard for simple authz
bikubi da78340
implement gate-based authz
bikubi 0dd1b6d
move gates to provider
bikubi b648e7c
try policy wip/stub
bikubi 091641b
cleanup
bikubi 6e48cb8
fix legacy user data handling
bikubi cb55eec
provide app version via config, appease psalm
bikubi 6a244ea
fix: reject JWTs with an empty user_hash claim
aivuk 28474ec
refactor: make ListUsersUseCase::execute an instance method
aivuk 0954c88
refactor: authorize in use cases, not controllers
aivuk 5ba0fbc
docs: record the authorization placement decision
aivuk 5ac5329
fix: make au_users_basedata.hash_id unique and indexed
aivuk 80dc39f
fix: don't assume every gated user is a LegacyUser
aivuk 6d70e76
refactor: single source of truth for the admin predicate
aivuk 4bd0fee
fix: block userlevel/status escalation on non-admin self-update
aivuk 9ae1464
test: cover privileged-field enforcement on user update
aivuk 18ae601
Merge branch 'fix/v2-jwt-hash-id-lookup' into v2-user-abstract-nikola
bikubi 93de0bd
Merge branch 'fix/v2-gate-before-type-guard' into v2-user-abstract-ni…
bikubi 2115778
Merge branch 'fix/v2-user-self-update-escalation' into v2-user-abstra…
bikubi 754590a
Merge branch 'refactor/v2-authz-in-usecase' into v2-user-abstract-nikola
bikubi 2d7c889
refactor gate names as enum
bikubi 5243261
api params follow new models' camelCase, not legacy column_names
bikubi 0dc95b9
Merge branch 'main' into v2-user-abstract-nikola
bikubi 13826ef
fix user status comparison
bikubi 59bc244
cleanup
bikubi a849aaa
improve tests
bikubi b2f27a5
readability
bikubi 90f0117
feat: Passport auth using Central:Client and Tenant:LegacyUser
nikola-maric-aula a2d64a2
fix(entrypoint.sh): ensure ./storage ownership (always)
nikola-maric-aula 7d3696c
fix(docker): ignore unrelated folders for the root project
nikola-maric-aula d0e4c11
feat: add custom JWT claims to OAuth2 Access Token
nikola-maric-aula 8422cb7
feat: legacy can verify assymetric key used inv2 JWT
nikola-maric-aula d75d24d
chore: docs and cleanup
nikola-maric-aula 7467a06
chore: remove unused tenant db seeder code
nikola-maric-aula c21eb1c
feat: repurpose LegacyLoginController in v2 authN
nikola-maric-aula 7d90b4d
Merge branch 'main' into feat/v2-auth-passport-cross-tenant
nikola-maric-aula eaaa18d
fix: unit tests
nikola-maric-aula c38192f
feat(tenancy): db user includes tenant id in its name
nikola-maric-aula 13b11d1
fix(test): create tenant command test
nikola-maric-aula 0c95578
fix(test): sso user insert to standard room
nikola-maric-aula ff38dec
fix: database seeder for tenants (hint: use --env=testing)
nikola-maric-aula bc2926b
feat: LegacyAuthTest -> OAuth/TokenCreateTest
nikola-maric-aula 9ba3d36
fix: sso controller and cleanup unused legacy jwt
nikola-maric-aula fa5502f
fix: sso-aware access token controller (renamed from legacy contrl.)
nikola-maric-aula e6cd050
chore: remove dead code LegacyJwtGuard
nikola-maric-aula d44dcb9
chore: rename pest tests to PestTest.php
nikola-maric-aula fb8999b
fix: SsoAwareAccessTokenController returns OAuth2-compatible response
nikola-maric-aula 2eab68e
chore: cleanup LegacyUser model
nikola-maric-aula 6b85d22
chore: debug setup for debugging tests
nikola-maric-aula bb2bc07
fix: composer update ide helpers not automatically
nikola-maric-aula File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,3 +26,6 @@ indent_size = 2 | |
|
|
||
| [Makefile] | ||
| indent_style = tab | ||
|
|
||
| [composer.lock] | ||
| indent_size = 4 | ||
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?php | ||
|
|
||
| namespace App\Auth\PassportJwtClaims; | ||
|
|
||
| use App\Models\LegacyUser; | ||
| use CorBosman\Passport\AccessToken; | ||
|
|
||
| class AulaClaims | ||
| { | ||
| /** | ||
| * Process the generated JWT token, attach aula-specific data to it. | ||
| * | ||
| * @param mixed $next | ||
| */ | ||
| public function handle(AccessToken $token, $next) | ||
| { | ||
| $user = LegacyUser::find($token->getUserIdentifier()); | ||
|
|
||
| $token->addClaim('user_hash', $user->hash_id); | ||
| $token->addClaim('temp_pw', !empty($user->temp_pw)); | ||
| $token->addClaim('user_level', $user->userlevel?->value); | ||
| $token->addClaim('roles', json_decode($user->roles ?? '[]')); | ||
|
|
||
| return $next($token); | ||
| } | ||
| } |
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
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work for me ootb because
post-update-cmdfails 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)?