The main interface which provides authentication services in Spring Security is the AuthenticationManager. This is usually an instance of Spring Security’s ProviderManager class, which you may already be familiar with if you’ve used the framework before. If not, it will be covered later, in the technical overview chapter. The bean instance is registered using the authentication-manager namespace element. You can’t use a custom AuthenticationManager if you are using either HTTP or method security through the namespace, but this should not be a problem as you have full control over the AuthenticationProvider s that are used.

在Spring Security中提供身份验证服务的主界面是AuthenticationManager。这通常是Spring Security的ProviderManager类的一个实例,如果您之前使用过该框架,那么您可能已经熟悉了它。如果没有,稍后将在技术概述章节中介绍。使用authentication-manager名称空间元素注册bean实例。如果通过命名空间使用HTTP或方法安全性,则不能使用自定义AuthenticationManager,但这不应该是一个问题,因为您可以完全控制所使用的AuthenticationProvider。
 
You may want to register additional AuthenticationProvider beans with the ProviderManager and you can do this using the <authentication-provider>element with the ref attribute, where the value of the attribute is the name of the provider bean you want to add. For example:
您可能希望使用ProviderManager注册其他AuthenticationProvider bean,并且可以使用带有ref属性的<authentication-provider>元素来执行此操作,其中该属性的值是您要添加的提供者bean的名称。例如:
 
<authentication-manager>
<authentication-provider ref="casAuthenticationProvider"/>
</authentication-manager> <bean id="casAuthenticationProvider"
class="org.springframework.security.cas.authentication.CasAuthenticationProvider">
...
</bean>

Another common requirement is that another bean in the context may require a reference to the AuthenticationManager. You can easily register an alias for the AuthenticationManager and use this name elsewhere in your application context.

另一个常见要求是上下文中的另一个bean可能需要引用AuthenticationManager。您可以轻松注册AuthenticationManager的别名,并在应用程序上下文的其他位置使用此名称。
 
<security:authentication-manager alias="authenticationManager">
...
</security:authentication-manager> <bean id="customizedFormLoginFilter"
class="com.somecompany.security.web.CustomFormLoginFilter">
<property name="authenticationManager" ref="authenticationManager"/>
...
</bean>

[1]You can find out more about the use of the ldap-server element in the chapter on Chapter 29, LDAP Authentication.

您可以在第29章LDAP身份验证章节中找到有关使用ldap-server元素的更多信息。

[2]See the section on Section 13.4, “Request Matching and HttpFirewall” in the Web Application Infrastructure chapter for more details on how matches are actually performed.

有关如何实际执行匹配的更多详细信息,请参阅“Web应用程序基础结构”一章中的第13.4节“请求匹配和HttpFirewall”一节。

[3]See the chapter on Chapter 22, Anonymous Authentication

请参阅第22章匿名身份验证一章

[4]The use of multiple <http> elements is an important feature, allowing the namespace to simultaneously support both stateful and stateless paths within the same application, for example. The previous syntax, using the attribute filters="none" on an intercept-url element is incompatible with this change and is no longer supported in 3.1.

多个<http>元素的使用是一个重要特性,例如,允许命名空间同时支持同一应用程序中的有状态和无状态路径。在intercept-url元素上使用属性filters =“none”的先前语法与此更改不兼容,并且在3.1中不再受支持。

[5]For more details on how channel-processing is implemented, see the Javadoc for ChannelProcessingFilter and related classes.

有关如何实现通道处理的更多详细信息,请参阅ChannelProcessingFilter的Javadoc和相关类。
 

Spring Security(二十四):6.6 The Authentication Manager and the Namespace的更多相关文章

  1. Spring Security(十四):5.4 Authorize Requests

    Our examples have only required users to be authenticated and have done so for every URL in our appl ...

  2. 设计模式学习(二十四):Spring 中使用到的设计模式

    设计模式学习(二十四):Spring 中使用到的设计模式 作者:Grey 原文地址: 博客园:设计模式学习(二十四):Spring 中使用到的设计模式 CSDN:设计模式学习(二十四):Spring ...

  3. Spring Boot(二十):使用spring-boot-admin对spring-boot服务进行监控

    Spring Boot(二十):使用spring-boot-admin对spring-boot服务进行监控 Spring Boot Actuator提供了对单个Spring Boot的监控,信息包含: ...

  4. spring boot / cloud (十四) 微服务间远程服务调用的认证和鉴权的思考和设计,以及restFul风格的url匹配拦截方法

    spring boot / cloud (十四) 微服务间远程服务调用的认证和鉴权的思考和设计,以及restFul风格的url匹配拦截方法 前言 本篇接着<spring boot / cloud ...

  5. Bootstrap<基础二十四> 缩略图

    Bootstrap 缩略图.大多数站点都需要在网格中布局图像.视频.文本等.Bootstrap 通过缩略图为此提供了一种简便的方式.使用 Bootstrap 创建缩略图的步骤如下: 在图像周围添加带有 ...

  6. 二十四、Struts2中的UI标签

    二十四.Struts2中的UI标签 Struts2中UI标签的优势: 数据回显 页面布局和排版(Freemark),struts2提供了一些常用的排版(主题:xhtml默认 simple ajax) ...

  7. WCF技术剖析之二十四: ServiceDebugBehavior服务行为是如何实现异常的传播的?

    原文:WCF技术剖析之二十四: ServiceDebugBehavior服务行为是如何实现异常的传播的? 服务端只有抛出FaultException异常才能被正常地序列化成Fault消息,并实现向客户 ...

  8. VMware vSphere 服务器虚拟化之二十四 桌面虚拟化之手动池管理物理机

    VMware vSphere 服务器虚拟化之二十四 桌面虚拟化之手动池管理物理机 VMwareView手动池可以管理物理计算机 说明: 环境基于实验二十三 1.准备一台Windows 7的物理计算机名 ...

  9. Bootstrap入门(二十四)data属性

    Bootstrap入门(二十四)data属性 你可以仅仅通过 data 属性 API 就能使用所有的 Bootstrap 插件,无需写一行 JavaScript 代码.这是 Bootstrap 中的一 ...

  10. 3360: [Usaco2004 Jan]算二十四

    3360: [Usaco2004 Jan]算二十四 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 6  Solved: 6[Submit][Statu ...

随机推荐

  1. 4种方法实现Html转码

    <script> var HtmlUtil = { /*1.用浏览器内部转换器实现html转码*/ htmlEncode: function(html) { //1.首先动态创建一个容器标 ...

  2. MySQL5.7: sql script demo

    -- MyISAM Foreign Keys显示不了外键,MyISAM此为5.0 以下版本使用 InnoDB 为5.0以上版本使用 drop table IF EXISTS city; CREATE ...

  3. sublime text2 中标签高亮效果BracketHighlighter插件

    1.打开package Control,选择install Package 2.输入BracketHighlighter,回车 3.这样该插件会自动安装,安装后所有的提示高亮都是白色或没有提示.按 p ...

  4. 洛谷P4578 [FJOI2018]所罗门王的宝藏(dfs)

    题意 题目链接 Sol 对于每个询问\(x, y, c\) 从在\((x, y)\)之间连一条边权为\(c\)的双向边,然后就是解\(K\)个二元方程. 随便带个数进去找找环就行了 #include& ...

  5. 7.Odoo产品分析 (二) – 商业板块(3) –CRM(1)

    查看Odoo产品分析系列--目录 CMR:Customer Relationship Management.企业为提高核心竞争力,利用相应的信息技术以及互联网技术协调企业与顾客间在销售.营销和服务上的 ...

  6. Python异常处理机制、调试、测试

    类似于Java的try..catch..finally Java的为try_except_finally try: print('try...') r = / print('result:', r) ...

  7. (后端)springboot 在idea中实现热部署(转)

    自己用到了iIntelliJ IDEA 这个ide工具,但是和以前的工具写html,css,js直接刷新页面不同,这个需要去热部署,网上搜的解决方法: SpringBoot的web项目,在每一次修改了 ...

  8. java传输文件的简单方法

    假设现在已经打包了一个文件(1233444333),要将这个文件传输给另一方: package file; import java.io.*; public class F_PasswordUnPas ...

  9. SQL server 导出平面文件时出错: The code page on Destination - 3_txt.Inputs[Flat File Destination Input].Columns[UserId] is 936 and is required to be 1252.

    我在导出平面文件时:Error 0xc00470d4: Data Flow Task 1: The code page on Destination - 3_txt.Inputs[Flat File ...

  10. SQL Server中通用数据库角色权限处理

    SQL Server中通用数据库角色权限处理   最近和同事在做数据库权限清理的事情,主要是删除一些账号:取消一些账号的较大的权限等,例如,有一些有db_owner权限,我们取消账号的数据库角色db_ ...