简短的问题:如果我在客户端公开其他用户的UID,会有什么风险/问题?
我的情况:我正在构建一个测试android应用程序,该应用程序必须能够允许1)用户foo请求授权,以便2)访问用户A的私有数据。
我不知道这是否是“ du”的事实,但是我似乎在Firebase上找不到关于“请勿暴露UID”的任何警告。我一直在浏览用户安全部分和Firebase的聊天示例演示,并且常用的方法似乎是创建一个“共享”或“授权”字段,其中授权用户的uid为true。我的问题主要是关于第一步。以下是我的数据结构的摘要。
{
"users" : {
"uid_of_user_a" : {
"requests" : {
"-KeXTQeFJ2gAiaazteO1" : {
"requestUid" : "uid_of_user_foo",
"targetUid" : "uid_of_user_a",
"timeStamp" : 123456
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的想法是这样。
请求字段的规则是:对于具有uid_of_user_a的用户,该字段是可读写的;对于任何经过身份验证的用户,只有当该用户推送与uid_of_user_a匹配的targetUid时,该字段才可写入。
在客户端,用户A附加了一个onChildEventListener,并带有对此字段的引用。当客户端收到onChildAdded回调时,将出现一个对话框,要求您进行确认。
如果确认,则客户端从请求消息中检索请求者的uid,并将其推送到“授权”字段
然后,用户A的私有数据可以被授权字段中列出的uid读取。
问题:需要向客户端公开另一个用户的uid。此方法类似于打电话给某人一样,呼叫者必须先知道接收端的电话号码。因此,在没有实际给出电话号码和电子邮件的情况下,某人必须以某种方式知道UID,以便甚至传递消息并要求获取可共享的数据,对吗?....但是,我的直观方法似乎很琐。
我一般是Firebase数据库和用户身份验证的新手,所以请原谅我的法语:)在此先感谢所有专家。
我正在将Android Room与RxJava一起使用
dependencies {
implementation 'androidx.room:room-rxjava2:2.1.0-alpha02'
}
Run Code Online (Sandbox Code Playgroud)
我需要从参数化删除方法中获取Completable,我认为此功能从2.1.0开始添加?例如
@Query("DELETE FROM message_table WHERE uid = :id")
Completable delete(String id);
@Query("DELETE FROM message_table")
Completable deleteAll();
Run Code Online (Sandbox Code Playgroud)
仍然会引发错误: Deletion methods must either return void or return int (the number of deleted rows).
我的应用程序要求是在玩家状态更改时更新媒体样式通知.之前完美地工作,触发并显示mediaSession的新媒体类型通知,没有声音或振动.
现在问题:在根据Android O要求构建通知渠道时,我使用以下代码创建通知渠道.然后令人讨厌的问题是,每次媒体会话改变时,每个通知都会更新,在Android O中现在播放通知声音.
我想为每个新通知禁用声音,如果我没有设置声音,则默认声音触发,在两个字段中传入null都不起作用.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel notificationChannel = new NotificationChannel(
NOTIFICATION_CHANNEL_ID,
"SimpleBakingApp Media Notification",
NotificationManager.IMPORTANCE_LOW
);
// Configure the notification channel.
notificationChannel.setDescription("Channel description");
notificationChannel.setSound(null,null); // <-- Is there a way to disable sound? null doesn't work
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.RED);
notificationChannel.enableVibration(false);
mNotificationManager.createNotificationChannel(notificationChannel);
}
Run Code Online (Sandbox Code Playgroud)
额外的信息,可能是相关的
我的showNotification()(构建通知的方法)触发Player.EventListener回调中的玩家状态更改,我正在使用ExoPlayer v2.
如何/在哪里可以获得地图上当前所有标记对象的引用,以便检查以下内容:
if (Markers.getTag().equals("something"))
Run Code Online (Sandbox Code Playgroud)
通过阅读Marker上的文档,它说"这比存储单独的Map更容易",所以我不想使用HashMap,除非有人说我绝对必须这样做.
谢谢,以下是伪伪代码
// uid是Marker的标签
// 1)在某种程度上检查当前配置文件是否存在标签
// 2)如果存在,则只需移动标记,只需设置此标记的新位置即可.
// 3)如果没有,则创建一个新标记,添加标记.
// 4)通过.setTag()将配置文件uid设置为标记的标记
// 5)动画移动相机到latlng位置
3-5是可以的,只需1-2
// 3) Create a new marker
// Marker to show on the map
Marker friendMarker;
// Add a marker when the image is loaded
friendMarker = googleMap.addMarker(new MarkerOptions()
.position(friendLatLng)
.icon(BitmapDescriptorFactory.fromBitmap(bitmap))
.title(friendProfile.getName()));
// Set the tag on this friend marker, so we can retrieve or update it later
friendMarker.setTag(friendProfile.getUid());
// 5) Animate the camera to that location
CameraPosition cameraPosition = new …Run Code Online (Sandbox Code Playgroud)