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

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

问题描述

有没有人有关于此答案所描述内容的示例应用程序?

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

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

推荐答案

使用以下步骤:


  • 第1步。在您的球衣应用程序中插入过滤器(请参阅泽西DOCS如何拦截请求)。

  • 第2步。要求客户端应用程序在Header中传递用户凭据,以便您在Jersey Service Filter中获取它们。

  • 第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天全站免登陆