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

Add kratos subject webhook endpoint #945

Open
wants to merge 28 commits into
base: feature/ory-based-authorization
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
50dc20b
Add kratos webhook endpoint for creating subjects through webhook
mpgxvii Aug 28, 2024
d1588ba
Separate out subject, researcher, admin identities
mpgxvii Aug 28, 2024
fc28314
Fix Kratos Identity class
mpgxvii Aug 28, 2024
b81e0fd
Fix formatting
mpgxvii Aug 28, 2024
d95a03b
Remove separate user identity property
mpgxvii Sep 9, 2024
54600d3
Remove kratosId from user dialog
mpgxvii Sep 9, 2024
d9999ef
Send activation email from Kratos directly
mpgxvii Sep 9, 2024
60f0fa4
Add support for projects in Kratos identity
mpgxvii Sep 10, 2024
157b915
Fix getting project in webhook
mpgxvii Sep 11, 2024
6f1110a
Fix scopes
mpgxvii Sep 13, 2024
632052c
Merge branch 'feature/ory-based-authorization' of https://github.com/…
mpgxvii Sep 16, 2024
b5f63b3
Merge branch 'minor-fixes' of https://github.com/RADAR-base/Managemen…
mpgxvii Sep 25, 2024
c4ff72f
Add specify project user id when creating subject
mpgxvii Sep 28, 2024
30ac797
Update Project class to include user id
mpgxvii Sep 28, 2024
580959c
Update subject activation endpoint to use project user id
mpgxvii Sep 28, 2024
932f131
Merge branch 'feature/ory-based-authorization' of https://github.com/…
mpgxvii Sep 30, 2024
fcfe271
Update Authservice and LoginEndpoint configs
mpgxvii Oct 8, 2024
968dae8
Refactor IdentityService to remove similar methods
mpgxvii Nov 25, 2024
a18bc56
Add support for updating identity server with changes in Subject and …
mpgxvii Nov 25, 2024
ac468e4
Rename userService method
mpgxvii Nov 25, 2024
a203098
Save identity id when creating user
mpgxvii Nov 26, 2024
ca378a0
Format SubjectService
mpgxvii Nov 26, 2024
5e52a1f
Fix tests
mpgxvii Nov 26, 2024
f5f9b33
Fix tests
mpgxvii Nov 26, 2024
0ea522d
Wrap updating of identity in try catch block in subject service
mpgxvii Nov 26, 2024
1c27e75
Check IdentityService is enabled before calling methods
mpgxvii Nov 26, 2024
3e83eb4
Fix scopes in login endpoint
mpgxvii Dec 3, 2024
d623939
Update IdentityService to patch existing identity instead of replacing
mpgxvii Dec 12, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ class KratosSessionDTO(
class Traits (
val name: String? = null,
val email: String? = null,
val projects: List<Projects>? = null,
)

@Serializable
class Projects (
val id: String? = null,
val name: String? = null,
val eligibility: Map<String, String>? = null,
val consent: Map<String, String>? = null,
mpgxvii marked this conversation as resolved.
Show resolved Hide resolved
mpgxvii marked this conversation as resolved.
Show resolved Hide resolved
)

@Serializable
Expand Down
2 changes: 1 addition & 1 deletion src/main/docker/etc/config/kratos/kratos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ selfservice:
enabled: true
use: code
after:
default_browser_return_url: http://localhost:3000/consent
default_browser_return_url: http://localhost:3000/study-consent

logout:
after:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ constructor(
throw IllegalArgumentException("Cannot create non-subject users")

val id = kratosIdentity.id ?: throw IllegalArgumentException("Identity ID is required")
val projectId =
webhookDTO.payload?.get("project_id")
val project =
kratosIdentity.traits.projects?.firstOrNull()
?: throw NotAuthorizedException("Cannot create subject without project")
val projectDto =
projectService.findOneByName(projectId)
projectService.findOneByName(project.id!!)
?: throw NotFoundException(
"Project not found: $projectId",
EntityName.PROJECT,
Expand Down
Loading