保护REST API使用安全REST插件 [英] Securing REST API with Security REST plugin

查看:301
本文介绍了保护REST API使用安全REST插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的高中建设GRAILS的房间调度决策支持工具。我使用Spring Security的,我想,以确保REST API。我发现用正确的方法做的信息非常少。不过,我一直在寻找的 Spring Security的REST插件

I'm building a decision support tool in GRAILS for the room scheduling at my highschool. I'm using Spring Security and I want to secure the REST api. I've found very little information on the proper way to do this. However I've been looking to the Spring Security REST plugin

该文档是不是我很清楚,使用这个插件没有任何人有一个工作的例子/教程?

The documentation is not very clear to me, does anyone have a working example/tutorial using this plugin?

这是如何实现这一建议将是巨大的。

Suggestions on how to implement this would be great.

推荐答案

我只是读出时序图响亮的为您服务。我在一个示例应用程序的工作使用这个插件,并(在客户端AngularJS),并将于近期发布(可能今晚)。

I am just reading out the sequence diagram loud for you. I am working on a sample app using this plugin and (AngularJS in client side) and will be releasing soon (probably tonight).

下面的步骤是:


  • 使用任何HTTP方法的REST资源客户端请求。

  • 服务器响应客户端与401。
  • 要求
  • 客户端(在接收到401)重定向用户到登录页面,以提供用户名和密码。 (记住的Spring Security核心插件)

  • 用户提供的用户名和密码。 (手段,客户应发出与用户的详细信息的请求主体/请求参数插件弹簧安全REST提供了POST请求击球/ API /登录)

  • 在接收用户信息服务器做4个任务:

    • 验证用户。

    • 生成令牌(默认由Spring Security的REST插件提供)。

    • 店铺令牌(在memcahe或GORM指定的域类)。

    • 返回回令牌中的被调用(客户端)。

    所以,你最终的REST端点的基于令牌的验证。
    通过插件的常见问题解答找到更多的答案。

    Therefore, you end up with a token based validation for the REST Endpoints. Go through plugin's FAQ for more answers.

    作者将很快推出最新版本的插件(1.3.0),并且你会发现文档中一些更新。

    Author will be releasing the latest version of plugin (1.3.0) very soon and you would find some updates in the documentation.

    我刚刚触及这个插件的基本功能,现在,但它具有很大的灵活性来处理的不仅仅是产生令牌多。例如,委托权威性OAuth的提供商。我会尽快,因为我把它推到GitHub上更新链接到这个答案上述示例应用程序。

    I have just touched the basic functionality of this plugin right now, but it has the flexibility to handle more than just generating token. Example, delegating auth to OAuth providers. I will update the link to the aforementioned sample app in this answer as soon as I push it to github.

    更新:结果
    示例应用程序

    这篇关于保护REST API使用安全REST插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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