【问题标题】:ReST API securityReST API 安全性
【发布时间】:2015-09-08 21:48:29
【问题描述】:

我正在创建一个将与 ReST API 通信的 Android 应用程序。我想知道如何为 API 提供安全性

这是我的示例 API 方法

@GET
    @Path("/count")
    public String totalUserCount(){
        return "100";
    }

这是我从 android 对 api 的调用

StringRequest stringRequesttoNearby = new StringRequest(
                        Request.Method.GET, 
                        url,
                        new Response.Listener<String>() {
                            
                            @Override
                            public void onResponse(String responseString) {
                             //response
                            }
                        }, 
                        new Response.ErrorListener() {
                            @Override
                            public void onErrorResponse(VolleyError error) {
                            }
                        })
                {
                    @Override
                    protected Map<String,String> getParams(){
                        Map<String,String> params = new HashMap<String, String>();                  
                        return params;
                    }
                };
                //add request to queue
                Singleton.getInstance().getRequestQueue().add(stringRequesttoNearby);

所以我想知道如何为这个 API 调用增加安全性

【问题讨论】:

标签: android rest security


【解决方案1】:

你可以使用Oauth1.0a,Oauth2查看链接

关注链接Secure Api

【讨论】:

    猜你喜欢
    • 2014-04-23
    • 2012-06-16
    • 2021-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-06
    • 2017-12-05
    相关资源
    最近更新 更多