Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393290
D4361.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4361.diff
View Options
diff --git a/services/identity/src/service.rs b/services/identity/src/service.rs
--- a/services/identity/src/service.rs
+++ b/services/identity/src/service.rs
@@ -104,28 +104,28 @@
async fn put_token_helper(
client: DatabaseClient,
auth_type: AuthType,
- user_id: String,
- device_id: String,
+ user_id: &str,
+ device_id: &str,
rng: &mut (impl Rng + CryptoRng),
-) -> Result<LoginResponse, Status> {
- let access_token_data =
- AccessTokenData::new(user_id, device_id, auth_type.clone(), rng);
+) -> Result<String, Status> {
+ if user_id.is_empty() || device_id.is_empty() {
+ error!(
+ "Incomplete data: user ID \"{}\", device ID \"{}\"",
+ user_id, device_id
+ );
+ return Err(Status::aborted("user not found"));
+ }
+ let access_token_data = AccessTokenData::new(
+ user_id.to_string(),
+ device_id.to_string(),
+ auth_type.clone(),
+ rng,
+ );
match client
.put_access_token_data(access_token_data.clone())
.await
{
- Ok(_) => match auth_type {
- AuthType::Wallet => Ok(LoginResponse {
- data: Some(WalletLoginResponse(WalletLoginResponseStruct {
- access_token: access_token_data.access_token,
- })),
- }),
- AuthType::Password => Ok(LoginResponse {
- data: Some(PakeLoginResponse(PakeLoginResponseStruct {
- data: Some(AccessToken(access_token_data.access_token)),
- })),
- }),
- },
+ Ok(_) => Ok(access_token_data.access_token),
Err(Error::RusotoPut(RusotoError::Service(
PutItemError::ResourceNotFound(_),
)))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 12:59 PM (20 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605051
Default Alt Text
D4361.diff (1 KB)
Attached To
Mode
D4361: [services][identity] update put_token_helper to return a String
Attached
Detach File
Event Timeline
Log In to Comment