Changeset View
Changeset View
Standalone View
Standalone View
services/identity/src/client_service.rs
Show All 31 Lines | |||||
}; | }; | ||||
use comm_opaque2::grpc::protocol_error_to_grpc_status; | use comm_opaque2::grpc::protocol_error_to_grpc_status; | ||||
use constant_time_eq::constant_time_eq; | use constant_time_eq::constant_time_eq; | ||||
use moka::future::Cache; | use moka::future::Cache; | ||||
use rand::rngs::OsRng; | use rand::rngs::OsRng; | ||||
use tonic::Response; | use tonic::Response; | ||||
use tracing::{debug, error}; | use tracing::{debug, error}; | ||||
use self::client_proto::ReservedRegistrationStartRequest; | use self::client_proto::{ | ||||
AddReservedUsernameRequest, RemoveReservedUsernameRequest, | |||||
ReservedRegistrationStartRequest, | |||||
}; | |||||
#[derive(Clone)] | #[derive(Clone)] | ||||
pub enum WorkflowInProgress { | pub enum WorkflowInProgress { | ||||
Registration(UserRegistrationInfo), | Registration(UserRegistrationInfo), | ||||
Login(UserLoginInfo), | Login(UserLoginInfo), | ||||
Update(UpdateState), | Update(UpdateState), | ||||
} | } | ||||
▲ Show 20 Lines • Show All 757 Lines • ▼ Show 20 Lines | let token_valid = self | ||||
message.access_token, | message.access_token, | ||||
) | ) | ||||
.await | .await | ||||
.map_err(handle_db_error)?; | .map_err(handle_db_error)?; | ||||
let response = Response::new(VerifyUserAccessTokenResponse { token_valid }); | let response = Response::new(VerifyUserAccessTokenResponse { token_valid }); | ||||
Ok(response) | Ok(response) | ||||
} | } | ||||
async fn add_reserved_username( | |||||
&self, | |||||
_request: tonic::Request<AddReservedUsernameRequest>, | |||||
) -> Result<tonic::Response<Empty>, tonic::Status> { | |||||
unimplemented!() | |||||
} | |||||
async fn remove_reserved_username( | |||||
&self, | |||||
_request: tonic::Request<RemoveReservedUsernameRequest>, | |||||
) -> Result<tonic::Response<Empty>, tonic::Status> { | |||||
unimplemented!() | |||||
} | |||||
} | } | ||||
pub fn handle_db_error(db_error: DBError) -> tonic::Status { | pub fn handle_db_error(db_error: DBError) -> tonic::Status { | ||||
match db_error { | match db_error { | ||||
DBError::AwsSdk(DynamoDBError::InternalServerError(_)) | DBError::AwsSdk(DynamoDBError::InternalServerError(_)) | ||||
| DBError::AwsSdk(DynamoDBError::ProvisionedThroughputExceededException( | | DBError::AwsSdk(DynamoDBError::ProvisionedThroughputExceededException( | ||||
_, | _, | ||||
)) | )) | ||||
Show All 9 Lines |