Web 安全是一个可怕的主题。所有的你的程序都依靠密码学,代码超出了你的控制。

尽管如此,你还是可以控制部分网页安全 --所有的logins和access checks和injection errors。

本章聚焦在user logins, roles, 和使用测试来确保基本的用户验证。

  • User Authentication and Authorization 用户验证和授权✅
  • Adding Users and Roles✅
  • Restricting Access✅
  • More Access-Control Testing ✅
  • Using Roles✅
  • Protection Against Form Modification 防止表格修改✅
  • Mass Assignment Testing✅
  • Other Security Resources❌没看

User Authentication and Authorization

安装gem 'devise'

根据提示:

设置config/environments/development.rb (粘贴过来就行)

加a root route

在视图上加flash提示。如果用手脚架建立了一个model,自动会有flash提示。

<p class="notice"><%= notice %></p>

<p class="alert"><%= alert %></p>

然后生成User model: rails g devise User , 因为用了RSpec和Factory_Bot所以有了

Rails 5 Test Prescriptions 第10章 Testing for Security的更多相关文章

  1. Rails 5 Test Prescriptions 第5章 Testing Models

    Rails,model层包含业务逻辑和储存逻辑.其中储存逻辑被ActiveRecord处理. 在model中,不是每件事都必须是ActiveRecord对象.model layer可以包含各种服务,对 ...

  2. Rails 5 Test Prescriptions 第10章 Unit_Testing JavaScript(新工具,learn曲线太陡峭,pass)

    对Js的单元测试是一个大的题目.作者认为Ruby的相关测试工具比Js的测试工具更灵活 大多数Js代码最终是关于响应用户的行为和改变DOM中的元素 没有什么javascript的知识点.前两节用了几个新 ...

  3. Rails 5 Test Prescriptions 第14章 Testing Exteranl Services(中断。)

    external testing strategy ✅ the service integration test✅ introduce VCR✅ Client Unit Tests ❌ Why an ...

  4. Rails 5 Test Prescriptions 第8章 Integration Testing with Capybara and Cucumber

    Capybara:  A complete reference is available atrubydoc.info. 集成测试就是把局部的程序组合起来测试. 端到端测试是一个特殊的集成测试,覆盖了 ...

  5. Rails 5 Test Prescriptions 第9章 Testing-JavaScript: Integration Testing,❌挂一个问题webpacker::helper

    使用Capybara进行JS的集成测试 谈论驱动 让测试通过 Webpack in Development Mode Js设计 是用户在网页上有好的体验的重要因素. 尽管如此,许多网页不测试JS. 部 ...

  6. Rails 5 Test Prescriptions 第11章其他部分的测试。

    Routes✅ Helper Methods✅ Controllers and Requests✅ Simulating Requests⚠️,看之前的博客 What to Expect in a R ...

  7. Rails 5 Test Prescriptions 第6章Adding Data to Tests

    bcreate the data quickly and easily.考虑测试运行的速度. fixtures and factories.以及下章讨论的test doubles,还有原生的creat ...

  8. Rails 5 Test Prescriptions 第4章 什么制造了伟大的测试

    伴随着程序成长,测试变长,复杂性增加,如何更高效的写测试,对以后开发不会造成麻烦. 测试本身没发被测试,所以一定要清楚,可控.不要加循环,不要过于复杂的自动编程. Cost and Value 成本和 ...

  9. Rails 5 Test Prescriptions 第3章Test-Driven Rails

    本章,你将扩大你的模型测试,测试整个Rails栈的逻辑(从请求到回复,使用端到端测试). 使用Capybara来帮助写end-to-end 测试. 好的测试风格,包括端到端测试,大量目标明确的单元测试 ...

随机推荐

  1. C++程序风格的思考

    转载自:http://www.cppblog.com/weiym/archive/2013/04/27/199781.html 发现厚积薄发中有很多值得学习的东西 故引用之: 最近有机会看号称是公司最 ...

  2. Yii 的session 实现返回上上页面

    学习session的页面:http://www.yiichina.com/doc/guide/2.0/runtime-sessions-cookies 关键摘要: $session = Yii::$a ...

  3. Yii2框架添加API Modules

    原文链接:http://www.itnose.net/detail/6459353.html : 一.环境部署 1. read fucking Yii Documents. http://www.yi ...

  4. 云笔记类APP推荐

    一.思绪收集类 Google Keep - 记事和清单 - Google Play 上的应用 注:谷歌 Keep 是最方便的收集思绪 APP 了.卡片视图,反应迅速,流畅,UI 漂亮,功能齐全,唯一不 ...

  5. Create an Index

    db.collection.createIndex( { name: -1 } ) Indexes — MongoDB Manual https://docs.mongodb.com/manual/i ...

  6. SUBSTRING_INDEX()

    http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_substring-index ) DEFAULT 'fru ...

  7. proxy ubuntu proxy--http://jingyan.baidu.com/article/8cdccae9913470315513cd70.html

    apt-get 设置代理 proxy 方法 方法一 :这是一种临时的手段,如果你仅仅是暂时需要通过http代理使用apt-get,你可以使用这种方法. 在使用 apt-get  之前,在终端中输入以下 ...

  8. 【Loadrunner】性能测试报告实战

    一.一份好的性能测试报告需要遵循什么规则? 好的报告只需要遵循3点即可:清晰的结构.简要的语言以及数据的对比. 二.如何用Loadrunner自动到处HTML以及word版的报告? 1.导出html格 ...

  9. uva 11105 - Semi-prime H-numbers(数论)

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u011328934/article/details/36644069 option=com_onli ...

  10. jQuery实现节点克隆、替换和互换

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...