Jersey JAX-RS + Spring 安全应用示例 [英] Jersey JAX-RS + Spring security application sample

查看:33
本文介绍了Jersey JAX-RS + Spring 安全应用示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人有关于这个答案中描述的示例应用程序吗?

Does anyone have a sample application about what is described on this answer?

Jersey REST 服务上的用户身份验证

推荐答案

使用如下步骤:

  • 第 1 步.在您的球衣应用程序中插入一个过滤器(请参阅 Jersey DOCS 如何拦截请求).
  • 第 2 步.要求客户端应用程序在 Header 中传递用户凭据,以便您在 Jersey 服务过滤器中获取它们.
  • 第 3 步.获取标头值并要求您的数据库验证它们.
  • 第 4 步.一旦验证使用安全上下文来存储原则(用户).
  • 第 5 步.使用存储的安全上下文来验证您的 Jersey 服务子资源.
  • Step 1. Insert a Filter(See Jersey DOCS how to intercept request) in your jersey Application.
  • Step 2. Ask client application to pass user credentials in Header, So that you fetch them in Jersey Service Filter.
  • Step 3. Fetch the header values and ask your DB to validate them.
  • Step 4. Once validated use Security Context to store the principle(User).
  • Step 5. Use stored Security Context to validate your Jersey Service sub-resource.

按照我的步骤,你会得到你的答案.

Follow my steps and you will achieve your answer.

这篇关于Jersey JAX-RS + Spring 安全应用示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆