[E] Shiro 官方文档阅读笔记 The Reading Notes of Shiro's Offical Docs
官方文档:
https://shiro.apache.org/reference.html
https://shiro.apache.org/java-authentication-guide.html
Terminology you’ll need
Subject - Security specific user ‘view’ of an application user. It can be a human being, a third-party process, a server connecting to you application, or even a cron job. Basically, it is anything or anyone communicating with your application.
Principals - A subjects identifying attributes. First name, last name, social security number, username
Credentials - secret data that are used to verify identities. Passwords, Biometric data, x509 certificates,
Realms - Security specific DAO, data access object, software component that talks to a backend data source. If you have usernames and password in LDAP, then you would have an LDAP Realm that would communicate with LDAP. The idea is that you would use a realm per back-end data source and Shiro would know how to coordinate with these realms together to do what you have to do.
First, we need to acquire the currently executing user, referred to as the subject.
A subject is just a security specific view of the user—-it can be a human, a process, cron job, doesn’t matter.
About "READMEMBER ME"
In Shiro, the Subject object supports two methods : isRemembered()
and isAuthenticated()
.
A “remembered” subject has an identity (it is not anonymous) and their identifying attributes,referred to as principals, are remembered from a successful authentication during a previous session.
An authenticated subject has proved their identity during their current session.
If a subject is remembered, it DOES NOT mean they are authenticated.
Login/Logout
//With most of Shiro, you'll always want to make sure you're working with the currently
//executing user, referred to as the subject
Subject currentUser = SecurityUtils.getSubject(); //Authenticate the subject by passing
//the user name and password token
//into the login method
currentUser.login(token); //Your Code Here
currentUser.logout(); //removes all identifying information and invalidates their session too.
rich exception hierarchy
丰富的异常层级(机制)
try {
currentUser.login(token);
} catch ( UnknownAccountException uae ) { ...
} catch ( IncorrectCredentialsException ice ) { ...
} catch ( LockedAccountException lae ) { ...
} catch ( ExcessiveAttemptsException eae ) { ...
} ... your own ...
} catch ( AuthenticationException ae ) {
//unexpected error?
}
//No problems, show authenticated view…
词汇部分
译:
Again really, really easy 非常非常简单/容易
retain 保留
authentication attempt 验证尝试.n
hierarchy 等级制度、层次、层级、阶层、层次结构
integration 整合;集成
音:
[E] Shiro 官方文档阅读笔记 The Reading Notes of Shiro's Offical Docs的更多相关文章
- python2.7官方文档阅读笔记
官方地址:https://docs.python.org/2.7/tutorial/index.html 本笔记只记录本人不熟悉的知识点 The Python Tutorial Index 1 Whe ...
- 保存与恢复变量和模型,tensorflow官方文档阅读笔记
官方中文文档的网址先贴出来:https://tensorflow.google.cn/programmers_guide/saved_model tf.train.Saver 类别提供了保存和恢复模型 ...
- Effective Go(官方文档)笔记
Effective Go(官方文档)笔记 自己主动局部变量提升(编译期完毕?):return &...; 内置函数: new/make copy, append delete range(这是 ...
- pm2 官方文档 学习笔记
一.安装 1.安装 npm install pm2 -g 2.更新 npm install pm2 -g && pm2 update pm2 update 是为了刷新 PM2 的守护进 ...
- vue.js 2.0 官方文档学习笔记 —— 01. vue 介绍
这是我的vue.js 2.0的学习笔记,采取了将官方文档中的代码集中到一个文件的形式.目的是保存下来,方便自己查阅. !官方文档:https://cn.vuejs.org/v2/guide/ 01. ...
- Vue2.0 官方文档学习笔记
VUE2.0官方文档 基础部分: 1.VUE简介 Vue是一个基于MVVM的框架,其中M代表数据处理层,V代表视图层即我们在Vue组件中的html部分,VM即M和V的结合层,处理M层相应的逻辑数据,在 ...
- django官方文档读书笔记
写在前面:这算是第二次读英文原文文档,第一次是读scrapy,感觉还是要做笔记,好记性不如烂笔头,现在已经忘了scrapy文档讲了什么了,心疼.以后要多读多写 经过半年的基础学习(懒,拖延)终于来到w ...
- Less 官方文档学习笔记
LESS 是css的一种扩展,它的编辑器是基于node.js 的less.js,将less文件编译成css文件(可压缩). 其中的概念: 变量:定义变量来代替某个值,只能编译一次,本质是“常量”.例如 ...
- Spark监控官方文档学习笔记
任务的监控和使用 有几种方式监控spark应用:Web UI,指标和外部方法 Web接口 每个SparkContext都会启动一个web UI,默认是4040端口,用来展示一些信息: 一系列调度的st ...
随机推荐
- 文件安全复制之 FastCopy
FastCopy是Windows平台上最快的文件拷贝.删除软件.由于其功能强劲,性能优越,一时间便超越相同类型的所有其他软件.由于该软件十分小巧,你甚至可以在安装后,直接将安装目录中的文件复制到任何可 ...
- MySQL for OPS 06:备份恢复
写在前面的话 人在河边走,湿鞋是早晚是事情,操作服务器,数据库也一样.谁也不知道自己哪一天控制不住自己就手贱.这时候有两个东西能救我们,一是备份,二是 bin log,bin log 前面讲了,但是 ...
- go中interface空指针不为nil判断方法
interface空指针不为nil 当把一个空指针对象赋值给一个interface后,再判断!= nil就不再成立了 代码如下 package main import "fmt" ...
- C# 调用腾讯即时通信 IM
IM SDK API 概述 https://cloud.tencent.com/document/product/269/33543 /// <summary> /// IM SDK 初始 ...
- 写一个操作 .ini文件的类
class IniHelp { private string iniPath; [DllImport("kernel32")] private static extern long ...
- [基础] - 从xx语言是跨平台的说起
我经常碰到一些人在说xx语言跨平台而yy语言不是(为避免不必要的纷争,在此不写具体语言但不影响阅读),从而来表明自己使用xx语言进行程序开发进而在编程语言鄙视链上高高在上很有优越感. 大概是从Java ...
- Delphi - OLE类实现TTS方式语音朗读
Delphi调用OLE类实现TTS方式语音朗读 直接看代码: unit uMain; interface uses Windows, Messages, SysUtils, Variants, Cla ...
- Jenkins配置LDAP认证
managerdn即为连接到AD的账号
- JDK1.8 Stream
Java 8 API添加了一个新的抽象称为流Stream,可以让你以一种声明的方式处理数据. Stream 使用一种类似用 SQL 语句从数据库查询数据的直观方式来提供一种对 Java 集合运算和表达 ...
- AI人脸识别的测试重点
最常见的 AI应用就是人脸识别,因此这篇文章从人脸识别的架构和核心上,来讲讲测试的重点. 测试之前需要先了解人脸识别的整个流程,红色标识代表的是对应AI架构中的各个阶段 首先是人脸采集. 安装拍照摄像 ...