Skip to content

Conversation

@malexw
Copy link
Collaborator

@malexw malexw commented Jun 18, 2024

Updates the login page from alexw/coral-login to dynamically add and hide the username / password form and a couple of single sign-on buttons depending on the backend's enabled auth strategies.

AI Description

This PR introduces changes to the authentication system, including the addition of new authentication strategies and updates to the existing ones.

  • The JWT_SECRET_KEY has been renamed to AUTH_SECRET_KEY in the .env-template file and the auth.guide.md documentation.
  • The auth.guide.md file has been updated to reflect the changes in the authentication process.
  • The ENABLED_AUTH_STRATEGIES list in auth.py now includes BasicAuthentication, GoogleOAuth, and OpenIDConnect.
  • The src/backend/main.py file has been updated to import the asyncio and os modules, and the get_strategy_endpoints function has been added to the list of imports from auth.py.
  • The src/backend/main.py file now includes the SessionMiddleware middleware, which is required for temporary OAuth state storage in the session.
  • The src/backend/routers/auth.py file has been updated to include the get_client_id and get_authorization_endpoint methods, and the login function has been modified to use the new authentication strategies.
  • The src/backend/services/auth/jwt.py file now uses the AUTH_SECRET_KEY environment variable instead of JWT_SECRET_KEY.
  • The src/backend/services/auth/strategies/base.py file has been updated to include the get_client_id, get_authorization_endpoint, and get_endpoints methods, and the authorize method has been added to the BaseOAuthStrategy class.
  • The src/backend/services/auth/strategies/google_oauth.py and src/backend/services/auth/strategies/oidc.py files have been modified to include the get_client_id, get_authorization_endpoint, and get_endpoints methods, and the authorize method has been added to the GoogleOAuth and OpenIDConnect classes.
  • The src/interfaces/coral_web/src/components/Welcome/OidcSSOButton.tsx file has been added to provide a button for OIDC sign-up and login.
  • The src/interfaces/coral_web/src/hooks/authConfig.ts file has been updated to include the useServerAuthStrategies hook and return the list of authentication strategies.
  • The src/interfaces/coral_web/src/hooks/githubAuthRoute.ts file has been removed.
  • The src/interfaces/coral_web/src/hooks/oidcAuthRoute.ts file has been updated to use the useAuthConfig hook and include the handleOidcAuth function.
  • The src/interfaces/coral_web/src/hooks/session.ts file now includes the googleSSOMutation and oidcSSOMutation mutations for handling Google and OIDC SSO, respectively.
  • The src/interfaces/coral_web/src/pages/auth/[strategy].tsx and src/interfaces/coral_web/src/pages/auth/complete.tsx files have been added to handle the callback from OAuth providers and forward the request to the backend.
  • The src/interfaces/coral_web/src/pages/login.tsx file has been updated to include the useOidcAuthRoute hook and the useMemo and useAuthConfig functions. The useGoogleAuthRoute hook has been removed, and the OidcSSOButton component has been added for OIDC sign-up and login.

Copy link
Collaborator

@tianjing-li tianjing-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me!

strategy_name = OpenIDConnect.NAME

return await authenticate(request, session, strategy_name)
# TODO..
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give more details here

@malexw malexw merged commit 67cb6dc into alexw/coral-login Jun 20, 2024
@malexw malexw deleted the alexw/google-oidc-sso branch June 20, 2024 14:52
malexw added a commit that referenced this pull request Jun 21, 2024
* add login page components

* Add Register page and hooks for auth

* Add the register page and connect all the frontend elements

* Redirect to /login if the token expires and clean up some console errors

* Add error messages for failed logins

* frontend: Add Single Sign-on to Toolkit (#227)

* Add Google SSO login plus OpenID components

* Dynamically set SSO login buttons and show or hide username and password based on auth_strategies

---------

Co-authored-by: Tianjing Li <[email protected]>

* fix startup event

* Fix build errors and update the API client

* Fix tests by adding missing env vars

Add test OIDC_WELL_KNOWN_ENDPOINT var to fixtures

* Add a walkthrough guide of the toolkit  (#251)

* GUide

* Chang

* Change

* Change

* Update docs/walkthrough/walkthrough.md

Co-authored-by: Luísa Moura <[email protected]>

* Update walkthrough.md

---------

Co-authored-by: Luísa Moura <[email protected]>

* coral-web: fix agent info panel opening by default (#253)

cast isEditAgentPanelOpen to boolean

* [backend] enforce agent update with user-id (#246)

* updates

* remove client changes

* remove logs

* use better header user id check

* fix validators

* typo

* Metrics: add middleware (#185)

* Metrics: add middleware

* add chat calls

* merge

* lint

* make it async

* add user id

* add more fields

* add retry and duration

* add meta

* comments

* fix tests

* improve error handling

* rename fields

* match spec

* comments

* clean code

* only create loop when theres endpoint

* add assistant id to chat

* feat(toolkit): show assistant welcome message (#255)

* feat(toolkit): show assistant welcome message

* feat(toolkit): show assistant welcome message

---------

Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Tianjing Li <[email protected]>
Co-authored-by: Beatrix De Wilde <[email protected]>
Co-authored-by: Luísa Moura <[email protected]>
Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Scott <[email protected]>
Co-authored-by: Khalil Najjar <[email protected]>
sanal-cohere pushed a commit that referenced this pull request Jun 21, 2024
* add login page components

* Add Register page and hooks for auth

* Add the register page and connect all the frontend elements

* Redirect to /login if the token expires and clean up some console errors

* Add error messages for failed logins

* frontend: Add Single Sign-on to Toolkit (#227)

* Add Google SSO login plus OpenID components

* Dynamically set SSO login buttons and show or hide username and password based on auth_strategies

---------

Co-authored-by: Tianjing Li <[email protected]>

* fix startup event

* Fix build errors and update the API client

* Fix tests by adding missing env vars

Add test OIDC_WELL_KNOWN_ENDPOINT var to fixtures

* Add a walkthrough guide of the toolkit  (#251)

* GUide

* Chang

* Change

* Change

* Update docs/walkthrough/walkthrough.md

Co-authored-by: Luísa Moura <[email protected]>

* Update walkthrough.md

---------

Co-authored-by: Luísa Moura <[email protected]>

* coral-web: fix agent info panel opening by default (#253)

cast isEditAgentPanelOpen to boolean

* [backend] enforce agent update with user-id (#246)

* updates

* remove client changes

* remove logs

* use better header user id check

* fix validators

* typo

* Metrics: add middleware (#185)

* Metrics: add middleware

* add chat calls

* merge

* lint

* make it async

* add user id

* add more fields

* add retry and duration

* add meta

* comments

* fix tests

* improve error handling

* rename fields

* match spec

* comments

* clean code

* only create loop when theres endpoint

* add assistant id to chat

* feat(toolkit): show assistant welcome message (#255)

* feat(toolkit): show assistant welcome message

* feat(toolkit): show assistant welcome message

---------

Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Tianjing Li <[email protected]>
Co-authored-by: Beatrix De Wilde <[email protected]>
Co-authored-by: Luísa Moura <[email protected]>
Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Scott <[email protected]>
Co-authored-by: Khalil Najjar <[email protected]>
sanal-cohere added a commit that referenced this pull request Jun 21, 2024
* Initial commit for Compass Tool

* coral-web: update first turn suggestions (#225)

* Addressed comments on the previous commit

* Added custom_context to parse and filters to search

* Formatting changes

* feat(assistant): Update conversation header (#229)

* feat(assistant): Update conversation header

* feat(assistant): Update conversation header

* update tooltip

* fix IconButton import

* Setup: fix dependencies (#243)

* feat(toolkit): show conversation list on with agents list (#231)

* Setup: remove redundant dependency (#244)

* Improve Auth guide (#235)

improve auth guide

* coral-web: create agent + agent base form (#212)

* create new agent form

* render agents list

* link back to base agent page

* perform post submission actions

* move input labels outside of input borders

* move submit button

* gen client

* factor out agent base form

* use default content type

* list custom agents

* check if agent name is unique

* and deployment + env variables to agent form

* add deployments

* clean up

* add submit modal

* push to new agent page on create success

* only show available deployments

* remove deployments dropdown

* feat: List Assistants returned from API (#242)

* feat: list agents from BE

* Update src/interfaces/coral_web/src/components/Conversation/MessagingContainer.tsx

Co-authored-by: misspia-cohere <[email protected]>

---------

Co-authored-by: misspia-cohere <[email protected]>

* nits

---------

Co-authored-by: Khalil Najjar <[email protected]>

* Propagate should_store logic to the File upload logic (#247)

should_store logic to the attach_files_to_messages

* [backend] passing in agent when calling streaming chat (#237)

* initial chat changes

* need to test

* done

* Remove old test

* default model for agents right now

* Organizations DB models, CRUD and tests   (#238)

* Organizations initial commit

* Organizations initial commit

* Organizations initial commit - sync main

* Organizations initial commit - sync main - blacked

* Organizations initial commit - sync main - lint

* Organizations initial commit - sync main - tests

* Organizations initial commit - sync main - tests

* Organizations initial commit - review fixes

* Organizations initial commit - review fixes

* Split up display name and name for Tools  (#241)

* CHange

* change

* coral-web: update assistant (#248)

* create new agent form

* render agents list

* link back to base agent page

* perform post submission actions

* move input labels outside of input borders

* move submit button

* gen client

* factor out agent base form

* check if agent name is unique

* and deployment + env variables to agent form

* add deployments

* clean up

* remove deployments dropdown

* init agent page

* create agent drawer

* use agent form

* add update agent request

* add get agent request

* fix rebase errors

* remove model from agent form

* add agent drawer to conversation

* remove unused componenets

* use new agent name for update success message

* fix(toolkit): Address code feedback + improvements (#249)

address code feedback improvements

---------

Co-authored-by: Khalil Najjar <[email protected]>

* feat(toolkit): add/remove recently used agents (#250)

* feat(toolkit): add/remove recently used agents

* merge main

* Add a walkthrough guide of the toolkit  (#251)

* GUide

* Chang

* Change

* Change

* Update docs/walkthrough/walkthrough.md

Co-authored-by: Luísa Moura <[email protected]>

* Update walkthrough.md

---------

Co-authored-by: Luísa Moura <[email protected]>

* coral-web: fix agent info panel opening by default (#253)

cast isEditAgentPanelOpen to boolean

* [backend] enforce agent update with user-id (#246)

* updates

* remove client changes

* remove logs

* use better header user id check

* fix validators

* typo

* Metrics: add middleware (#185)

* Metrics: add middleware

* add chat calls

* merge

* lint

* make it async

* add user id

* add more fields

* add retry and duration

* add meta

* comments

* fix tests

* improve error handling

* rename fields

* match spec

* comments

* clean code

* only create loop when theres endpoint

* add assistant id to chat

* feat(toolkit): show assistant welcome message (#255)

* feat(toolkit): show assistant welcome message

* feat(toolkit): show assistant welcome message

* frontend: Login, logout, and account creation (#179)

* add login page components

* Add Register page and hooks for auth

* Add the register page and connect all the frontend elements

* Redirect to /login if the token expires and clean up some console errors

* Add error messages for failed logins

* frontend: Add Single Sign-on to Toolkit (#227)

* Add Google SSO login plus OpenID components

* Dynamically set SSO login buttons and show or hide username and password based on auth_strategies

---------

Co-authored-by: Tianjing Li <[email protected]>

* fix startup event

* Fix build errors and update the API client

* Fix tests by adding missing env vars

Add test OIDC_WELL_KNOWN_ENDPOINT var to fixtures

* Add a walkthrough guide of the toolkit  (#251)

* GUide

* Chang

* Change

* Change

* Update docs/walkthrough/walkthrough.md

Co-authored-by: Luísa Moura <[email protected]>

* Update walkthrough.md

---------

Co-authored-by: Luísa Moura <[email protected]>

* coral-web: fix agent info panel opening by default (#253)

cast isEditAgentPanelOpen to boolean

* [backend] enforce agent update with user-id (#246)

* updates

* remove client changes

* remove logs

* use better header user id check

* fix validators

* typo

* Metrics: add middleware (#185)

* Metrics: add middleware

* add chat calls

* merge

* lint

* make it async

* add user id

* add more fields

* add retry and duration

* add meta

* comments

* fix tests

* improve error handling

* rename fields

* match spec

* comments

* clean code

* only create loop when theres endpoint

* add assistant id to chat

* feat(toolkit): show assistant welcome message (#255)

* feat(toolkit): show assistant welcome message

* feat(toolkit): show assistant welcome message

---------

Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Tianjing Li <[email protected]>
Co-authored-by: Beatrix De Wilde <[email protected]>
Co-authored-by: Luísa Moura <[email protected]>
Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Scott <[email protected]>
Co-authored-by: Khalil Najjar <[email protected]>

* fix(toolkit): UX/UI improvements (#257)

* Add error troubleshooting (#262)

* Update chat.py

---------

Co-authored-by: Jessica Wu <[email protected]>
Co-authored-by: Khalil Najjar <[email protected]>
Co-authored-by: Luísa Moura <[email protected]>
Co-authored-by: Tomeu <[email protected]>
Co-authored-by: Tianjing Li <[email protected]>
Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Eugene P <[email protected]>
Co-authored-by: Scott <[email protected]>
Co-authored-by: Beatrix De Wilde <[email protected]>
Co-authored-by: Alex W <[email protected]>
Co-authored-by: misspia-cohere <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants