Spring Security and CAS Interaction Sequence
Spring Security and CAS Interaction Sequence
The basic interaction between a web browser, CAS server and a Spring Security-secured service is as follows:
-
The web user is browsing the service's public pages. CAS or Spring Security is not involved.
-
The user eventually requests a page that is either secure or one of the beans it uses is secure. Spring Security's
ExceptionTranslationFilter
will detect theAccessDeniedException
orAuthenticationException
. -
Because the user's
Authentication
object (or lack thereof) caused anAuthenticationException
, theExceptionTranslationFilter
will call the configuredAuthenticationEntryPoint
. If using CAS, this will be theCasAuthenticationEntryPoint
class. -
The
CasAuthenticationEntryPoint
will redirect the user's browser to the CAS server. It will also indicate aservice
parameter, which is the callback URL for the Spring Security service (your application). For example, the URL to which the browser is redirected might behttps://my.company.com/cas/login?service=https%3A%2F%2Fserver3.company.com%2Fwebapp%2Fj_spring_cas_security_check
. -
After the user's browser redirects to CAS, they will be prompted for their username and password. If the user presents a session cookie which indicates they've previously logged on, they will not be prompted to login again (there is an exception to this procedure, which we'll cover later). CAS will use the
PasswordHandler
(orAuthenticationHandler
if using CAS 3.0) discussed above to decide whether the username and password is valid. -
Upon successful login, CAS will redirect the user's browser back to the original service. It will also include a
ticket
parameter, which is an opaque string representing the "service ticket". Continuing our earlier example, the URL the browser is redirected to might behttps://server3.company.com/webapp/j_spring_cas_security_check?ticket=ST-0-ER94xMJmn6pha35CQRoZ
. -
Back in the service web application, the
CasAuthenticationFilter
is always listening for requests to/j_spring_cas_security_check
(this is configurable, but we'll use the defaults in this introduction). The processing filter will construct aUsernamePasswordAuthenticationToken
representing the service ticket. The principal will be equal toCasAuthenticationFilter.CAS_STATEFUL_IDENTIFIER
, whilst the credentials will be the service ticket opaque value. This authentication request will then be handed to the configuredAuthenticationManager
. -
The
AuthenticationManager
implementation will be theProviderManager
, which is in turn configured with theCasAuthenticationProvider
. TheCasAuthenticationProvider
only responds toUsernamePasswordAuthenticationToken
s containing the CAS-specific principal (such asCasAuthenticationFilter.CAS_STATEFUL_IDENTIFIER
) andCasAuthenticationToken
s (discussed later). -
CasAuthenticationProvider
will validate the service ticket using aTicketValidator
implementation. This will typically be aCas20ServiceTicketValidator
which is one of the classes included in the CAS client library. In the event the application needs to validate proxy tickets, theCas20ProxyTicketValidator
is used. TheTicketValidator
makes an HTTPS request to the CAS server in order to validate the service ticket. It may also include a proxy callback URL, which is included in this example:https://my.company.com/cas/proxyValidate?service=https%3A%2F%2Fserver3.company.com%2Fwebapp%2Fj_spring_cas_security_check&ticket=ST-0-ER94xMJmn6pha35CQRoZ&pgtUrl=https://server3.company.com/webapp/j_spring_cas_security_proxyreceptor
. -
Back on the CAS server, the validation request will be received. If the presented service ticket matches the service URL the ticket was issued to, CAS will provide an affirmative response in XML indicating the username. If any proxy was involved in the authentication (discussed below), the list of proxies is also included in the XML response.
-
[OPTIONAL] If the request to the CAS validation service included the proxy callback URL (in the
pgtUrl
parameter), CAS will include apgtIou
string in the XML response. ThispgtIou
represents a proxy-granting ticket IOU. The CAS server will then create its own HTTPS connection back to thepgtUrl
. This is to mutually authenticate the CAS server and the claimed service URL. The HTTPS connection will be used to send a proxy granting ticket to the original web application. For example,https://server3.company.com/webapp/j_spring_cas_security_proxyreceptor?pgtIou=PGTIOU-0-R0zlgrl4pdAQwBvJWO3vnNpevwqStbSGcq3vKB2SqSFFRnjPHt&pgtId=PGT-1-si9YkkHLrtACBo64rmsi3v2nf7cpCResXg5MpESZFArbaZiOKH
. -
The
Cas20TicketValidator
will parse the XML received from the CAS server. It will return to theCasAuthenticationProvider
aTicketResponse
, which includes the username (mandatory), proxy list (if any were involved), and proxy-granting ticket IOU (if the proxy callback was requested). -
Next
CasAuthenticationProvider
will call a configuredCasProxyDecider
. TheCasProxyDecider
indicates whether the proxy list in theTicketResponse
is acceptable to the service. Several implementations are provided with Spring Security:RejectProxyTickets
,AcceptAnyCasProxy
andNamedCasProxyDecider
. These names are largely self-explanatory, exceptNamedCasProxyDecider
which allows aList
of trusted proxies to be provided. -
CasAuthenticationProvider
will next request aAuthenticationUserDetailsService
to load theGrantedAuthority
objects that apply to the user contained in theAssertion
. -
If there were no problems,
CasAuthenticationProvider
constructs aCasAuthenticationToken
including the details contained in theTicketResponse
and theGrantedAuthority
s. -
Control then returns to
CasAuthenticationFilter
, which places the createdCasAuthenticationToken
in the security context. -
The user's browser is redirected to the original page that caused the
AuthenticationException
(or a custom destination depending on the configuration).
It's good that you're still here! Let's now look at how this is configured
120余万的搜狗细胞词库-fcitx&ibus拼音输入法词库:个人无聊的作品 (附加说明) - 查看主题 • Ubuntu中文论坛
http://code.google.com/p/hslinuxextra/downloads/list
上面的地址中,增加了三个词库文件和工程的源代码,有兴趣的同学可以自己去搞搞。
三个词库文件分别为:精简的词库、较全面的词库和非常全面的词库,自己下载解压后使用。
另外,很多人说词频不对,我现在调整了一下逻辑:ibus中词频信息没做任何变化,而fcitx中原有词频是较高等级而新词等级较低。
ibus pinyin要求最低为1.3.0,这个大家注意一下。
大家需要注意的是,不同版本甚至同一个版本不同发行版上词库db的目录可能不一样
请根据您自己的发行版和版本查找对应的文件覆盖
另外,经过与ibus开发者协商,ibus-pinyin的词库查找规则做了一些更改,只要在词库目录(就是有一个.db文件的那个目录,一般是/usr/share/ibus-pinyin/db目录)把新词库复制过来并改名为local.db就可以使用了,如果感觉词库不好直接删除掉local.db就可以让ibus使用原来的词库。
这两天,真的很累,没有一刻闲着的,公司的事情太多,太累了。
忙着无聊的时候,去搜狐的输入法网站上转了转,发现它竟然能下输入法词库文件
这个词库,utf-16编码的,反向出来以后,我给导入到了ibus拼音输入法里面了
唉,大家别怪我
去下面这个地址下载下来
http://code.google.com/p/hslinuxextra/downloads/list上的android.7z
或者直接点击链接:
http://hslinuxextra.googlecode.com/files/android.7z
然后解压,你应该会看到一个android.db文件,把这个文件放到/usr/share/ibus-pinyin/db里面,覆盖同名的db文件
不过有的同学ibus-pinyin的词库是openphrase的,反正这个目录里面只有一个db文件,你用你下载解压的那个文件改名后覆盖掉就行了
覆盖以后,你把ibus重启一下,如果你能打出下面的这个词组,说明生效了:
我的这个词库,基于ibus原有的android词库文件,另外增加了搜狐的下列词库:
IT计算机 电脑词汇大全 历史名人大全 搜狗标准大词库 医学词汇大全
财会词汇大全 电子计算机通信专业术语农业词汇大全 搜狗精选词库 艺术家小辞海
常用餐饮词汇【官方推荐】电子术语大全 农业类词库 搜狗万能词库 音乐大杂烩
常用植物名 动物词汇大全 农业系统扩充词库唐诗宋词成语俗语 饮食词汇大全
虫蛇类名词 概率与数理统计词库pro 全面词库 网络流行新词 影视歌名库
船舶港口词汇大全 化学词汇大全 诗词名句大全 网上最全的11.44万全国四级行政区划词库职业作家词库
地理地质词汇大全 机械工程词汇大全 书法词库大全 药品名称大全 最详细的全国地名大全
地质大词典 计算机名词 搜狗标准词库 医学词汇大全 (1)
我知道我的行为不妥,但是我的目的是让大家能学到新的词语
望大家勿怪
PS:我发现这个词库虽然比较大,但是实际占用内存不多,ibus的相应也挺迅速
---------------------------我是华丽的分割线-----------------------------------
另外,我增加了fcitx的词库:pyPhrase.org pyphrase.mb pybase.mb
http://hslinuxextra.googlecode.com/files/fcitx.7z
下载并解压
其中pyphrase.mb pybase.mb是编译好的词库,连同pyPhrase.org直接覆盖已经安装好的fcitx中的同名文件即可:/usr/share/fcitx/data中(把解压后的三个文件同时覆盖fcitx原有文件)
pyPhrase.org是源文件,编译时覆盖源代码目录的同名文件,也同样会生成pyphrase.mb。
请同学们多加使用
另外,由于ibus使用的sql,所以兼容性问题不大,但是对于fcitx来说可能会有问题出现,如果你的不能用,那么用下面的命令自己根据pyPhrase来做mb文件:
把生成的mb文件连同pyPhrase.org覆盖掉fcitx安装的data文件就可以了
Oracle快速插入500w条数据sql语句_一声叹息_新浪博客
declare
count1 number(10):=1;
begin
end;