Issue:
feat(users): add schema and apis for org authentication methods

Setup table and end points for org authentication methods
- This will be used to support SSO login
- Orgs can also setup multiple other authentication methods

Resolution:
<think>
PR Context:
- Title: feat(users): setup user authentication methods schema and apis
- Merged: 2024-06-21T11:14:39Z
- Files changed: 29 files
- Commits: 25 commits

Implementation approach:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
The PR:
- Sets up schema for user authentication methods
- adds queries to interact with schema
- adds endpoints to create, update and list authentication methods

### Additional Changes

- [x] This PR modifies the API contract
- [x] This PR modifies the database schema
- [x]
</think>

To implement this, you'll need to modify:


**Detailed Implementation:**


**Commit 1:** feat(users): setup user authentication methods schema and apis (#4999)
Co-authored-by: hyperswitch-b
Files to modify:


**crates/api_models/src/events/user.rs**
  Modify existing code

**crates/api_models/src/user.rs**
  Add:
    - struct: pub::OpenIdConnectPrivateConfig
    - struct: pub::OpenIdConnectPublicConfig
    - struct: pub::OpenIdConnect
    - struct: pub::CreateUserAuthenticationMethodRequest
    - struct: pub::UpdateUserAuthenticationMethodRequest
    - struct: pub::GetUserAuthenticationMethodsRequest
    - struct: pub::UserAuthenticationMethodResponse
    - struct: pub::AuthMethodDetails
    - enum: pub::AuthConfig
    - enum: pub::OpenIdProvider

**crates/common_enums/src/enums.rs**
  Add:
    - enum: pub::UserAuthType
    - enum: pub::Owner

**crates/diesel_models/src/lib.rs**
  Add:
    - mod: pub::user_authentication_method

**crates/diesel_models/src/query.rs**
  Add:
    - mod: pub::user_authentication_method

**crates/diesel_models/src/query/user_authentication_method.rs**
  Add:
    - function: pub::insert
    - function: pub::list_user_authentication_methods_for_auth_id
    - function: pub::list_user_authentication_methods_for_owner_id
    - function: pub::update_user_authentication_method
    - impl: impl UserAuthenticationMethodNew
    - impl: impl UserAuthenticationMethod

**crates/diesel_models/src/schema.rs**
  Modify existing code

**crates/diesel_models/src/user_authentication_method.rs**
  Add:
    - function: private::from
    - struct: pub::UserAuthenticationMethod
    - struct: pub::UserAuthenticationMethodNew
    - struct: pub::OrgAuthenticationMethodUpdateInternal
    - enum: pub::UserAuthenticationMethodUpdate
    - impl: impl From<UserAuthenticationMethodUpdate> for OrgAuthenticationMethodUpdateInternal

**crates/router/src/configs/secrets_transformers.rs**
  Add:
    - function: private::convert_to_raw_secret
    - impl: impl SecretsHandler for settings::UserAuthMethodSettings

**crates/router/src/configs/settings.rs**
  Add:
    - struct: pub::UserAuthMethodSettings

**crates/router/src/core/errors/user.rs**
  Modify existing code

**crates/router/src/core/user.rs**
  Add:
    - function: pub::create_user_authentication_method
    - function: pub::update_user_authentication_method
    - function: pub::list_user_authentication_methods

**crates/router/src/db.rs**
  Add:
    - mod: pub::user_authentication_method

**crates/router/src/db/kafka_store.rs**
  Add:
    - function: private::insert_user_authentication_method
    - function: private::list_user_authentication_methods_for_auth_id
    - function: private::list_user_authentication_methods_for_owner_id
    - function: private::update_user_authentication_method
    - impl: impl UserAuthenticationMethodInterface for KafkaStore

**crates/router/src/db/user_authentication_method.rs**
  Add:
    - function: private::insert_user_authentication_method
    - function: private::list_user_authentication_methods_for_auth_id
    - function: private::list_user_authentication_methods_for_owner_id
    - function: private::update_user_authentication_method
    - function: private::insert_user_authentication_method
    - function: private::list_user_authentication_methods_for_auth_id
    - function: private::list_user_authentication_methods_for_owner_id
    - function: private::update_user_authentication_method
    - trait: pub::UserAuthenticationMethodInterface
    - impl: impl UserAuthenticationMethodInterface for Store
    - impl: impl UserAuthenticationMethodInterface for MockDb

**crates/router/src/routes/app.rs**
  Modify existing code

**crates/router/src/routes/lock_utils.rs**
  Modify existing code

**crates/router/src/routes/user.rs**
  Add:
    - function: pub::create_user_authentication_method
    - function: pub::update_user_authentication_method
    - function: pub::list_user_authentication_methods

**crates/router/src/types/storage.rs**
  Add:
    - mod: pub::user_authentication_method

**crates/router/src/types/storage/user_authentication_method.rs**
  Modify existing code

**crates/router/src/utils/user.rs**
  Add:
    - function: private::foreign_from
    - impl: impl ForeignFrom<user_api::AuthConfig> for common_enums::UserAuthType

**crates/router_env/src/logger/types.rs**
  Modify existing code

**crates/storage_impl/src/mock_db.rs**
  Modify existing code