-
Notifications
You must be signed in to change notification settings - Fork 13
Feature/whoami test page #212
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
base: main
Are you sure you want to change the base?
Conversation
padraic-shafer
left a comment
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.
Rather than creating a new route and module, it might make more sense here to revive the existing "person/me" route and update the endpoint handler to use the user principal name and to add the LDAP info into the Person or a Person-derived schema.
nsls2api/src/nsls2api/api/v1/user_api.py
Lines 76 to 79 in 015d444
| # TODO: Add back into schema if we decide to use this endpoint. | |
| @router.get("/person/me", response_model=str, include_in_schema=False) | |
| async def get_myself(current_user: Annotated[Person, Depends(get_current_user)]): | |
| return current_user |
https://github.com/NSLS2/nsls2api/blob/main/src/nsls2api/api/models/person_model.py
| conn = None | ||
| try: | ||
| server = Server(ldap_server) | ||
| conn = Connection(server, user=bind_user, password=bind_password, auto_bind=True) |
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.
ldap3 appears to support ASYNC connections. This would be advantageous to avoid blocking.
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.
Attempted client_strategy=ASYNC for non-blocking LDAP, but conn.result after conn.search did not reliably wait for completion or fetch results. Would need proper asyncio integration for true async; reverted to default strategy since it works reliably for now.
removed /whoami |
added /whoami endpoint to get user info from LDAP
Removed
/person/meAdded/Updated