-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IDPF-237 Rework API structure & config (#71)
- Loading branch information
1 parent
cb9c23e
commit af60fac
Showing
10 changed files
with
131 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,18 +1,16 @@ | ||
from django.contrib import admin | ||
from django.urls import include, path | ||
|
||
from core.api import protected_apis | ||
from core.api.scim import router as scim_router | ||
from core.api.sso_profile import router as sso_profile_router | ||
from core.api import main_api, people_finder_api, scim_api, sso_profile_api | ||
|
||
|
||
protected_apis.add_router("/scim/v2/Users", scim_router) | ||
protected_apis.add_router("/sso", sso_profile_router) | ||
|
||
urlpatterns = [ | ||
path("", include("core.urls")), | ||
path("api/", protected_apis.urls), | ||
path("api/scim/", scim_api.urls), | ||
path("api/sso/", sso_profile_api.urls), | ||
path("api/peoplefinder/", people_finder_api.urls), | ||
path(route="api/", view=main_api.urls), | ||
path("admin/", admin.site.urls), | ||
path("auth/", include("authbroker_client.urls")), | ||
path("pingdom/", include("pingdom.urls")), | ||
path("", include("core.urls")), | ||
] |
This file contains 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 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,29 @@ | ||
from ninja import Router | ||
|
||
from core import services as core_services | ||
from core.schemas import Error | ||
from core.schemas.profiles import ProfileMinimal | ||
from profiles.models.combined import Profile | ||
|
||
|
||
router = Router() | ||
identity_router = Router() | ||
router.add_router("identity", identity_router) | ||
|
||
|
||
# NB this is a placeholder to get the router running, it may need editing or deleting etc. | ||
@identity_router.get( | ||
"{id}", | ||
response={ | ||
200: ProfileMinimal, | ||
404: Error, | ||
}, | ||
) | ||
def get_user(request, id: str): | ||
"""Just a demo, do not build against this.""" | ||
try: | ||
return core_services.get_by_id(id) | ||
except Profile.DoesNotExist: | ||
return 404, { | ||
"message": "Unable to find user", | ||
} |
This file contains 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,29 @@ | ||
from ninja import Router | ||
|
||
from core import services as core_services | ||
from core.schemas import Error | ||
from core.schemas.profiles import ProfileMinimal | ||
from profiles.models.combined import Profile | ||
|
||
|
||
router = Router() | ||
profile_router = Router() | ||
router.add_router("person", profile_router) | ||
|
||
|
||
# NB this is a placeholder to get the router running, it may need editing or deleting etc. | ||
@profile_router.get( | ||
"{id}", | ||
response={ | ||
200: ProfileMinimal, | ||
404: Error, | ||
}, | ||
) | ||
def get_user(request, id: str): | ||
"""Just a demo, do not build against this""" | ||
try: | ||
return core_services.get_by_id(id) | ||
except Profile.DoesNotExist: | ||
return 404, { | ||
"message": "Unable to find user", | ||
} |
This file contains 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 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 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 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,5 @@ | ||
# Main | ||
|
||
> This API is available at `/api/` | ||
The ID service exposes an API that provides general functionality. |
This file contains 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,5 @@ | ||
# People Finder | ||
|
||
> This API is available at `/api/peoplefinder/` | ||
The ID service exposes an API that provides read and edit functionality designed for the PeopleFinder / Intranet integration. |
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SSO profile retrieval | ||
# SSO fast profile retrieval | ||
|
||
> This API is available at `/api/sso/` | ||
|