ColdFusion和移动应用程序结构和安全性(ColdFusion and Mobile Application Structure and Security)
概观
我正在寻找使用HTML5,jQuery和ColdFusion开始开发iOS应用程序。 我对此的理解是让jQuery为所有后端函数调用ColdFusion API。 大! 我的问题主要是关于页面结构和API安全性。
应用结构
在我的脑海中,我建议应用程序的实际结构应该类似于:
<html> <head> <script src="http://foo.bar/path/to/jquery.js"></script> <script src="http://foo.bar/path/to/api.js"></script> <script src="http://foo.bar/path/to/anyother.js"></script> </head> <body> ... </body> </html>
这个想法是出于组织目的。 我不想在实际的应用程序中包含任何API调用。 我希望它位于远程机器上。 这将允许我进行编辑,而无需将应用程序重新提交到应用商店。
安全
这种结构会有安全隐患吗? 我有什么办法可以增强这种安全性吗? 也许只允许来自移动设备的API调用? 或者可能需要某种钥匙?
此外,当谈到实际的API本身。 该功能的安全性如何工作?
<cffunction name="newRemoteResponse" access="remote" output="false" returntype="struct"> .... </cffunction>
您建议使用哪些参数来确保最安全?
Overview
I'm looking to start developing iOS apps using HTML5, jQuery, and ColdFusion. My understanding of this is to have jQuery call the ColdFusion API's for all of he back-end functions. Great! My question is mostly about the page structure and API security.
Application Structure
In my head I suggested that the actual structure of the app should be similar to this:
<html> <head> <script src="http://foo.bar/path/to/jquery.js"></script> <script src="http://foo.bar/path/to/api.js"></script> <script src="http://foo.bar/path/to/anyother.js"></script> </head> <body> ... </body> </html>
The idea of this is for organizational purposes. I don't want to include any API calls inside the actual app. I would like it to be located on a remote machine. This will allow me to make edits without resubmitting the app to the app store.
Security
Will this structure be a security risk? Is there anything I can do to enhance the security of this? Perhaps only allow API calls coming from a mobile device? Or perhaps require some sort of key?
Also, when it comes to the actual API itself. How would the function's security work?
<cffunction name="newRemoteResponse" access="remote" output="false" returntype="struct"> .... </cffunction>
What parameters would you recommend to make this the most secure?
原文:https://stackoverflow.com/questions/22539834
最满意答案
您可以使用以下方法设置接收位置更新的最小距离: https : //developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String,%20long,%20float, %20android.location.LocationListener)
此外,无论应用程序是打开还是关闭,您都可以使用运行的服务来收听位置更新。 只要应用程序打开和/或设备启动,您就可以启动此服务。 有关这个问题的更多信息: 尝试在Android上启动时启动服务
这样它始终在运行,并将根据您的要求接收位置更新。
You can set a minimum distance for receiving location updates using i.e. the following method: https://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.location.LocationListener)
Also, you can listen to location updates using a Service that runs regardless whether the app is open or closed. You can make this service start up whenever the app opens and/or the device boots up. For more info on that look at this question: Trying to start a service on boot on Android
This way it is always running and will receive location updates as per your requirements.
相关问答
更多-
您可以使用setSmallestDisplacement设置更新之间的最小行程距离(以米为单位)。 只需将其添加到您的代码中。 mLocationRequest.setSmallestDisplacement(SMALLEST_DISPLACEMENT); You can use setSmallestDisplacement to set the smallest distance traveled between updates in meters. Just add this to your code ...
-
当我在Android M或更低版本上使用时,它的确定 不它不是。 在Android的所有版本上, getLastKnownLocation()通常返回null 。 getLastKnownLocation()是一个优化。 使用它,但要准备在getLastKnownLocation()返回null或过期值时依赖onLocationChanged() 。 这在文档中以及有关Android应用程序开发的书籍和课程中都有介绍。 and its OK when i'm using on android M or lo ...
-
这取决于你的轨道。 您始终可以测量起点和当前位置之间的距离。 如果你直线跑,那很好 - 距离总是增加: 但如果您的曲目是弯曲的,则会出现错误。 请看下面的图片:沿着实线从起点到终点,在曲线后面,距离减小。 总距离为虚线。 极端情况是在同一点开始和结束,因为你的距离是零! 您必须始终测量当前位置与之前位置之间的距离,并总结所有距离。 It depends on your track. You always measure the distance between the starting point and ...
-
如果您想以某种方式自己进行此计算,Google搜索将提供解决方案。 例如,Haversine方法: var R = 6371; // km var dLat = (lat2-lat1).toRad(); var dLon = (lon2-lon1).toRad(); var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * Math.sin ...
-
在android中长途旅行期间用户位置不会改变(User location doesn't change during long distance travelling in android)[2022-09-15]
在AlarmManager.setRepeating()类型设置为ELAPSED_REALTIME_WAKEUP或RTC_WAKEUP,以便在设备休眠时运行。 然后,当您必须创建一个BroadcastReceiver触发并接收警报事件时,您可以请求更新并处理其他事件。 In AlarmManager.setRepeating() Set type to ELAPSED_REALTIME_WAKEUP or RTC_WAKEUP so it will run if the device sleeps. The ... -
从两个位置获取距离(Get distance from two location)[2022-07-09]
请仔细阅读此链接。 这段代码是成功运行在我的应用程序 http://ckpatel.blog.com/category/android-gps/ please Read carefully this link. this code is successfull run in my apps http://ckpatel.blog.com/category/android-gps/ -
select Loc1ID, Loc2ID, distance from (select Loc1ID, Loc2ID, distance, rank() over(partition by Loc1ID order by distance desc) rn from DISTANCE) a where rn =1 select Loc1ID, Loc2ID, distance from (select Loc1ID, Loc2ID, distance, rank() over(partiti ...
-
android:当距离发生相当大的变化时获取位置(android: Getting location when there is considerable change in distance)[2023-11-21]
您可以使用以下方法设置接收位置更新的最小距离: https : //developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String,%20long,%20float, %20android.location.LocationListener) 此外,无论应用程序是打开还是关闭,您都可以使用运行的服务来收听位置更新。 只要应用程序打开和/或设备启动,您就可 ... -
使用distanceBetween方法,因为它听起来已经有了坐标,这就是使用此方法所需的全部内容: Location.distanceBetween()Javadoc 此链接可能对您有所帮助,因为它详细说明了使用Haversine公式计算距离。 摘抄: 这个脚本[在Javascript中]使用' Haversine '公式计算两点之间的大圆距离 - 即地球表面上的最短距离。 使用geocoder.getFromLocationName ,您将获得一个Address对象列表,在这些对象中,您将找到有关该位置的 ...
-
这里的问题是调用.values给出了一个GeoPoint()对象列表。 有一个解决方法,虽然我们需要做一些额外的工作来引入适当的Java类。 我们需要拥有两个点的经度和纬度。 import org.elasticsearch.common.geo.GeoDistance; import org.elasticsearch.common.unit.DistanceUnit; base_point = doc['base_location'].value; if (!doc['location'].e ...