<<上篇 | 首页 | 下篇>>

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:

  1. The web user is browsing the service's public pages. CAS or Spring Security is not involved.

  2. 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 the AccessDeniedException or AuthenticationException.

  3. Because the user's Authentication object (or lack thereof) caused an AuthenticationException, the ExceptionTranslationFilter will call the configuredAuthenticationEntryPoint. If using CAS, this will be the CasAuthenticationEntryPoint class.

  4. The CasAuthenticationEntryPoint will redirect the user's browser to the CAS server. It will also indicate a service parameter, which is the callback URL for the Spring Security service (your application). For example, the URL to which the browser is redirected might be https://my.company.com/cas/login?service=https%3A%2F%2Fserver3.company.com%2Fwebapp%2Fj_spring_cas_security_check.

  5. 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 thePasswordHandler (or AuthenticationHandler if using CAS 3.0) discussed above to decide whether the username and password is valid.

  6. 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.

  7. 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 a UsernamePasswordAuthenticationToken representing the service ticket. The principal will be equal to CasAuthenticationFilter.CAS_STATEFUL_IDENTIFIER, whilst the credentials will be the service ticket opaque value. This authentication request will then be handed to the configured AuthenticationManager.

  8. The AuthenticationManager implementation will be the ProviderManager, which is in turn configured with the CasAuthenticationProvider. TheCasAuthenticationProvider only responds to UsernamePasswordAuthenticationTokens containing the CAS-specific principal (such asCasAuthenticationFilter.CAS_STATEFUL_IDENTIFIER) and CasAuthenticationTokens (discussed later).

  9. CasAuthenticationProvider will validate the service ticket using a TicketValidator implementation. This will typically be a Cas20ServiceTicketValidatorwhich is one of the classes included in the CAS client library. In the event the application needs to validate proxy tickets, the Cas20ProxyTicketValidator is used. The TicketValidator 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.

  10. 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.

  11. [OPTIONAL] If the request to the CAS validation service included the proxy callback URL (in the pgtUrl parameter), CAS will include a pgtIou string in the XML response. This pgtIou represents a proxy-granting ticket IOU. The CAS server will then create its own HTTPS connection back to the pgtUrl. 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.

  12. The Cas20TicketValidator will parse the XML received from the CAS server. It will return to the CasAuthenticationProvider a TicketResponse, which includes the username (mandatory), proxy list (if any were involved), and proxy-granting ticket IOU (if the proxy callback was requested).

  13. Next CasAuthenticationProvider will call a configured CasProxyDecider. The CasProxyDecider indicates whether the proxy list in the TicketResponse is acceptable to the service. Several implementations are provided with Spring Security: RejectProxyTicketsAcceptAnyCasProxy and NamedCasProxyDecider. These names are largely self-explanatory, except NamedCasProxyDecider which allows a List of trusted proxies to be provided.

  14. CasAuthenticationProvider will next request a AuthenticationUserDetailsService to load the GrantedAuthority objects that apply to the user contained in theAssertion.

  15. If there were no problems, CasAuthenticationProvider constructs a CasAuthenticationToken including the details contained in the TicketResponse and theGrantedAuthoritys.

  16. Control then returns to CasAuthenticationFilter, which places the created CasAuthenticationToken in the security context.

  17. 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文件:

代码:
createPYMB /usr/share/fcitx/data/gbkpy.org ./pyPhrase.org


把生成的mb文件连同pyPhrase.org覆盖掉fcitx安装的data文件就可以了

 

阅读全文……

标签 : , ,

Oracle快速插入500w条数据sql语句_一声叹息_新浪博客

declare

count1 number(10):=1;

begin

    loop

      insert into TASK_ITEMS

      values

        (

        HIBERNATE_SEQUENCE.nextval, '470400205421112'||count1, '21-000000002222');

        count1 := count1+1;

       exit when count1>1000000;

     end loop;

end;

阅读全文……

标签 : , ,