Rails 5 Test Prescriptions 第10章 Testing for Security
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的更多相关文章
- Rails 5 Test Prescriptions 第5章 Testing Models
Rails,model层包含业务逻辑和储存逻辑.其中储存逻辑被ActiveRecord处理. 在model中,不是每件事都必须是ActiveRecord对象.model layer可以包含各种服务,对 ...
- Rails 5 Test Prescriptions 第10章 Unit_Testing JavaScript(新工具,learn曲线太陡峭,pass)
对Js的单元测试是一个大的题目.作者认为Ruby的相关测试工具比Js的测试工具更灵活 大多数Js代码最终是关于响应用户的行为和改变DOM中的元素 没有什么javascript的知识点.前两节用了几个新 ...
- Rails 5 Test Prescriptions 第14章 Testing Exteranl Services(中断。)
external testing strategy ✅ the service integration test✅ introduce VCR✅ Client Unit Tests ❌ Why an ...
- Rails 5 Test Prescriptions 第8章 Integration Testing with Capybara and Cucumber
Capybara: A complete reference is available atrubydoc.info. 集成测试就是把局部的程序组合起来测试. 端到端测试是一个特殊的集成测试,覆盖了 ...
- Rails 5 Test Prescriptions 第9章 Testing-JavaScript: Integration Testing,❌挂一个问题webpacker::helper
使用Capybara进行JS的集成测试 谈论驱动 让测试通过 Webpack in Development Mode Js设计 是用户在网页上有好的体验的重要因素. 尽管如此,许多网页不测试JS. 部 ...
- Rails 5 Test Prescriptions 第11章其他部分的测试。
Routes✅ Helper Methods✅ Controllers and Requests✅ Simulating Requests⚠️,看之前的博客 What to Expect in a R ...
- Rails 5 Test Prescriptions 第6章Adding Data to Tests
bcreate the data quickly and easily.考虑测试运行的速度. fixtures and factories.以及下章讨论的test doubles,还有原生的creat ...
- Rails 5 Test Prescriptions 第4章 什么制造了伟大的测试
伴随着程序成长,测试变长,复杂性增加,如何更高效的写测试,对以后开发不会造成麻烦. 测试本身没发被测试,所以一定要清楚,可控.不要加循环,不要过于复杂的自动编程. Cost and Value 成本和 ...
- Rails 5 Test Prescriptions 第3章Test-Driven Rails
本章,你将扩大你的模型测试,测试整个Rails栈的逻辑(从请求到回复,使用端到端测试). 使用Capybara来帮助写end-to-end 测试. 好的测试风格,包括端到端测试,大量目标明确的单元测试 ...
随机推荐
- 170619、springboot编程之HelloWorld
springboot资料看了一段时间了,个人觉得开发效率相当高,也参考了网上很多大牛的技术博客,在这里面我也记录一下,方便以后自己翻阅查看,同时也给新手最一点点指引.如果有侵权大牛博客文章,请告诉我, ...
- beans有无状态
Spring Bean Scopes https://www.tutorialspoint.com/spring/spring_bean_scopes.htm When defining a < ...
- 一道题浅析 i++,++i,i+1及(引用)&i的区别
我们可能很清楚i++,++i和i+1级&i的概念,但在实际运用中我们就有可能很容易搞混淆.特别是在递归中区别它们就显得尤为重要了.那首先我们先看一段利用递归逆序字符串的代码,你能回答出这段代码 ...
- MVC项目,bootstrap升级后index.d.ts编译出错
安装最新的Typescript组件 下载链接 https://www.microsoft.com/en-us/download/details.aspx?id=48593
- python __init__ 构造函数
实例化过程 会执行__init__ 的函数方法 class SQLHelper: def __init__(self): # self = s1 print("helo") def ...
- IQKeyboardManager第三方库的使用
IQKeyboardManager是iOS中解决键盘弹起遮挡UITextField/UITextView的一种很实用的工具.无需输入任何代码,不需要额外的设置.使用IQKeyboardManager的 ...
- 当IDENTITY_INSERT设置为OFF时不能向表插入显示值。(源:MSSQLServer,错误码:544)
错误提示"事务和快照同步时提示:当IDENTITY_INSERT设置为OFF时不能向表插入显示值.(源:MSSQLServer,错误码:544)" 原因:在SQL2008同步时到S ...
- Java8新特性(转载)
1.Lambda表达式 Lambda表达式(也称为闭包)是整个Java 8发行版中最受期待的在Java语言层面上的改变.使用 Lambda 表达式可以使代码变的更加简洁紧凑. Lambda允许把函数作 ...
- [RGEOS]空间拓扑关系
-1.判断两个线段是否平行 inline bool parallel_seg_seg(Segment_2 S1, Segment_2 S2) { Vector_2 u(S1); Vector_2 v( ...
- 《TP5.0学习笔记---模型篇》
https://blog.csdn.net/self_realian/article/details/78596261 一.什么是模型 为什么我们要在项目中使用模型,其实我们知道,我们可以直接在控制器 ...