Issue:
Bug: fix: cover sso nitpicks and todo changes



Nitpicks
- change parsing login for configs
- refactor terminate auth select
- clear cookie in rotate and reset password

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
The PR
- removes cookie after rotate password and reset password
- refactor parsing for sso config, now it uses `serde json from value` instead of `parse value`
- refactors terminate auth select
- send bad request instead of internal server error if invalid id is passed to auth/select 

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
closes #5146 


## How did you test it?
For bad request id for in auth select:
```
curl --location 'http://localhost:8080/user/auth/select' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SPT' \
--data '{
    "id":"wrong id"
}'
```
Response
```
{
    "error": {
        "type": "invalid_request",
        "message": "Invalid user auth method operation",
        "code": "UR_44"
    }
}
```
For valid id Response token type can be `sso` or `totp`, (tested for both valid ids from db to get correct token type)
```
{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYjJkNjMxZDUtMGQzMi00Y2IxLTg2MTQtNWVlNWI2MDczYTVkIiwicHVycG9zZSI6InNzbyIsIm9yaWdpbiI6ImFjY2VwdF9pbnZpdGF0aW9uX2Zyb21fZW1haWwiLCJwYXRoIjpbImF1dGhfc2VsZWN0Il0sImV4cCI6MTcxOTY2NjMxNX0.wz8bA3_xqD1J59t3N7jhMCpC-uQDZE2edMED93f8RrY",
    "token_type": "sso"
}
```

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible


Testing:
For bad request id for in auth select:
```
curl --location 'http://localhost:8080/user/auth/select' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SPT' \
--data '{
    "id":"wrong id"
}'
```
Response
```
{
    "error": {
        "type": "invalid_request",
        "message": "Invalid user auth method operation",
        "code": "UR_44"
    }
}
```
For valid id Response token type can be `sso` or `totp`, (tested for both valid ids from db to get correct token type)
```
{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYjJkNjMxZDUtMGQzMi00Y2IxLTg2MTQtNWVlNWI2MDczYTVkIiwicHVycG9zZSI6InNzbyIsIm9yaWdpbiI6ImFjY2VwdF9pbnZpdGF0aW9uX2Zyb21fZW1haWwiLCJwYXRoIjpbImF1dGhfc2VsZWN0Il0sImV4cCI6MTcxOTY2NjMxNX0.wz8bA3_xqD1J59t3N7jhMCpC-uQDZE2edMED93f8RrY",
    "token_type": "sso"
}
```

Patch:
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index 3e9145c2d33..ff1477aa3c9 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -4,7 +4,6 @@ use api_models::{
     payments::RedirectionResponse,
     user::{self as user_api, InviteMultipleUserResponse},
 };
-use common_utils::ext_traits::ValueExt;
 #[cfg(feature = "email")]
 use diesel_models::user_role::UserRoleUpdate;
 use diesel_models::{
@@ -481,7 +480,7 @@ pub async fn rotate_password(
         .await
         .map_err(|e| logger::error!(?e));
 
-    Ok(ApplicationResponse::StatusOk)
+    auth::cookies::remove_cookie_response()
 }
 
 #[cfg(feature = "email")]
@@ -544,7 +543,7 @@ pub async fn reset_password_token_only_flow(
         .await
         .map_err(|e| logger::error!(?e));
 
-    Ok(ApplicationResponse::StatusOk)
+    auth::cookies::remove_cookie_response()
 }
 
 #[cfg(feature = "email")]
@@ -597,7 +596,7 @@ pub async fn reset_password(
         .await
         .map_err(|e| logger::error!(?e));
 
-    Ok(ApplicationResponse::StatusOk)
+    auth::cookies::remove_cookie_response()
 }
 
 pub async fn invite_multiple_user(
@@ -2174,10 +2173,10 @@ pub async fn list_user_authentication_methods(
             .map(|auth_method| {
                 let auth_name = match (auth_method.auth_type, auth_method.public_config) {
                     (common_enums::UserAuthType::OpenIdConnect, Some(config)) => {
-                        let open_id_public_config: user_api::OpenIdConnectPublicConfig = config
-                            .parse_value("OpenIdConnectPublicConfig")
-                            .change_context(UserErrors::InternalServerError)
-                            .attach_printable("unable to parse generic data value")?;
+                        let open_id_public_config =
+                            serde_json::from_value::<user_api::OpenIdConnectPublicConfig>(config)
+                                .change_context(UserErrors::InternalServerError)
+                                .attach_printable("Unable to parse OpenIdConnectPublicConfig")?;
 
                         Ok(Some(open_id_public_config.name))
                     }
@@ -2216,13 +2215,14 @@ pub async fn get_sso_auth_url(
         utils::user::decrypt_oidc_private_config(&state, user_authentication_method.private_config)
             .await?;
 
-    let open_id_public_config: user_api::OpenIdConnectPublicConfig = user_authentication_method
-        .public_config
-        .ok_or(UserErrors::InternalServerError)
-        .attach_printable("Public config not present")?
-        .parse_value("OpenIdConnectPublicConfig")
-        .change_context(UserErrors::InternalServerError)
-        .attach_printable("unable to parse OpenIdConnectPublicConfig")?;
+    let open_id_public_config = serde_json::from_value::<user_api::OpenIdConnectPublicConfig>(
+        user_authentication_method
+            .public_config
+            .ok_or(UserErrors::InternalServerError)
+            .attach_printable("Public config not present")?,
+    )
+    .change_context(UserErrors::InternalServerError)
+    .attach_printable("Unable to parse OpenIdConnectPublicConfig")?;
 
     let oidc_state = Secret::new(nanoid::nanoid!());
     utils::user::set_sso_id_in_redis(&state, oidc_state.clone(), request.id).await?;
@@ -2267,13 +2267,14 @@ pub async fn sso_sign(
         utils::user::decrypt_oidc_private_config(&state, user_authentication_method.private_config)
             .await?;
 
-    let open_id_public_config: user_api::OpenIdConnectPublicConfig = user_authentication_method
-        .public_config
-        .ok_or(UserErrors::InternalServerError)
-        .attach_printable("Public config not present")?
-        .parse_value("OpenIdConnectPublicConfig")
-        .change_context(UserErrors::InternalServerError)
-        .attach_printable("unable to parse OpenIdConnectPublicConfig")?;
+    let open_id_public_config = serde_json::from_value::<user_api::OpenIdConnectPublicConfig>(
+        user_authentication_method
+            .public_config
+            .ok_or(UserErrors::InternalServerError)
+            .attach_printable("Public config not present")?,
+    )
+    .change_context(UserErrors::InternalServerError)
+    .attach_printable("Unable to parse OpenIdConnectPublicConfig")?;
 
     let redirect_url =
         utils::user::get_oidc_sso_redirect_url(&state, &open_id_public_config.name.to_string());
@@ -2329,14 +2330,14 @@ pub async fn terminate_auth_select(
         .store
         .get_user_authentication_method_by_id(&req.id)
         .await
-        .change_context(UserErrors::InternalServerError)?;
+        .to_not_found_response(UserErrors::InvalidUserAuthMethodOperation)?;
 
     let current_flow = domain::CurrentFlow::new(user_token, domain::SPTFlow::AuthSelect.into())?;
     let mut next_flow = current_flow.next(user_from_db.clone(), &state).await?;
 
     // Skip SSO if continue with password(TOTP)
     if next_flow.get_flow() == domain::UserFlow::SPTFlow(domain::SPTFlow::SSO)
-        && user_authentication_method.auth_type != common_enums::UserAuthType::OpenIdConnect
+        && !utils::user::is_sso_auth_type(&user_authentication_method.auth_type)
     {
         next_flow = next_flow.skip(user_from_db, &state).await?;
     }
diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs
index 6b957281f76..e80fe8d1de8 100644
--- a/crates/router/src/utils/user.rs
+++ b/crates/router/src/utils/user.rs
@@ -1,7 +1,8 @@
 use std::{collections::HashMap, sync::Arc};
 
 use api_models::user as user_api;
-use common_utils::{errors::CustomResult, ext_traits::ValueExt};
+use common_enums::UserAuthType;
+use common_utils::errors::CustomResult;
 use diesel_models::{encryption::Encryption, enums::UserStatus, user_role::UserRole};
 use error_stack::ResultExt;
 use masking::{ExposeInterface, Secret};
@@ -206,7 +207,7 @@ pub fn get_redis_connection(state: &SessionState) -> UserResult<Arc<RedisConnect
         .attach_printable("Failed to get redis connection")
 }
 
-impl ForeignFrom<user_api::AuthConfig> for common_enums::UserAuthType {
+impl ForeignFrom<user_api::AuthConfig> for UserAuthType {
     fn foreign_from(from: user_api::AuthConfig) -> Self {
         match from {
             user_api::AuthConfig::OpenIdConnect { .. } => Self::OpenIdConnect,
@@ -244,8 +245,7 @@ pub async fn decrypt_oidc_private_config(
     .into_inner()
     .expose();
 
-    private_config
-        .parse_value("OpenIdConnectPrivateConfig")
+    serde_json::from_value::<user_api::OpenIdConnectPrivateConfig>(private_config)
         .change_context(UserErrors::InternalServerError)
         .attach_printable("unable to parse OpenIdConnectPrivateConfig")
 }
@@ -286,3 +286,10 @@ fn get_oidc_key(oidc_state: &str) -> String {
 pub fn get_oidc_sso_redirect_url(state: &SessionState, provider: &str) -> String {
     format!("{}/redirect/oidc/{}", state.conf.user.base_url, provider)
 }
+
+pub fn is_sso_auth_type(auth_type: &UserAuthType) -> bool {
+    match auth_type {
+        UserAuthType::OpenIdConnect => true,
+        UserAuthType::Password | UserAuthType::MagicLink => false,
+    }
+}