初探Spring Security

remoting
 Provides intergration with Spring Remoting
 
web
 Contains filters and related web-security infrastructure code.Anything with a servlet API dependency.
 You’ll need it if you require Spring Security web authentication services and URL-based access-control.
 the main package is:
  org.springframework.security.web
 
config
 Contains the security namespace parsing code.You need it if you are using the Spring Security XML namespace for configuration.
 None of the classes are intended for direct use in an application.
 the main package is:
  org.springframework.security.config
  
LDAP
 LDAP authentication and provisioning code.Required if you need to use LDAP authentication or manage LDAP user entries.web

ACL
 Specialized domain object ACL implementation.Used to apply security to specific domain object instances within your application.spring

CAS
 Spring Security’s CAS client integration.If you want to use Spring Security web authentication with a CAS single sign-on server.
 
OpenID
 OpenID web authentication support. Used to authenticate users against an external OpenID server. express


http 配置
    http元素负责建立FilterChainProxy并过滤它使用的beans。一般filter预约义位置和不正确的filter顺序将再也不是一个问题。


    属性
        HTTP Security 配置容器,能够定义多个元素,每一个封闭安全配置提供指定模式。
        也能够经过设置"security"属性为"none"绕过spring security配置的过滤器。
        
        auto-config
            遗留属性,自动注册一个表单登陆,基本认证和logout URL和logout 服务。
            如未指定,默认false。咱们建议您避免使用这个,而显式配置你须要的服务。
        entry-point-ref
            在ExceptionTranslationFilter上设置定制的AuthenticationEntryPoint。
        use-expressions
            在< intercept-url >元素的"access"属性中可使用表达式,默认false。
            若启用,每一个属性应该包含一个表达式。若该表达式的值为true,访问将被受权。
        access-denied-page
            访问拒绝时转向的页面,弃用access-denied-handler元素。
        servlet-api-provision
            提供的版本HttpServletRequest安全方法如isUserInRole()和getPrincipal()。
            经过访问Spring SecurityContext实现。默认为“true”。
    
    子元素
        custom-filter
            用来代表一个过滤器bean声明应该被归入安全过滤器链。
            
            before
                定制的filter应该放在链中哪一个一个以前。
                    - FIRST
                    - CHANNEL_FILTER
                    - SECURITY_CONTEXT_FILTER
                    - CONCURRENT_SESSION_FILTER
                    - WEB_ASYNC_MANAGER_FILTER
                    - HEADERS_FILTER
                    - CSRF_FILTER
                    - LOGOUT_FILTER
                    - X509_FILTER
                    - PRE_AUTH_FILTER
                    - CAS_FILTER
                    - FORM_LOGIN_FILTER
                    - OPENID_FILTER
                    - LOGIN_PAGE_FILTER
                    - DIGEST_AUTH_FILTER
                    - BASIC_AUTH_FILTER
                    - REQUEST_CACHE_FILTER
                    - SERVLET_API_SUPPORT_FILTER
                    - JAAS_API_SUPPORT_FILTER
                    - REMEMBER_ME_FILTER
                    - ANONYMOUS_FILTER
                    - SESSION_MANAGEMENT_FILTER
                    - EXCEPTION_TRANSLATION_FILTER
                    - FILTER_SECURITY_INTERCEPTOR
                    - SWITCH_USER_FILTER
                    - LAST
            position
                明确位置custom-filter应放置在链条。若是你是替换一个标准的过滤器。api

org.springframework.security.web.AuthenticationEntryPoint
    经过ExceptionTranslationFilter使用开始一个身份认证方案
    ExceptionTranslationFilter将填充AbstractAuthenticationProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY使用请求目标的URL到HttpSession在调用该方法前
    实现应该修改ServletResponse上的headers必要时开始认证处理
    
org.springframework.security.cas.web.CasAuthenticationEntryPoint
    经过ExceptionTranslationFilter使用开始一个身份认证经过JA-SIG Central Authentication Service(CAS)
    用户浏览器将重定向到CAS登陆页面,该页面经过loginUrl指定,一旦登陆成功,该CAS登陆页面将重定向页面显示经过service propertie
    service是一个http URL属于当前的应用程序,该service URL由CasAuthenticationFilter监控及将验证CAS登陆是否成功。
    
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
    抽象的处理器基于浏览器的基于http身份验证请求
    该filter须要设置authenticationManager属性,一个AuthenticationManager处理认证请求的tokens,由实现类建立。
    若请求匹配setRequiresAuthenticationRequestMatcher(RequestMatcher),该filter将拦截该请求并尝试执行认证。
    认证由其子类实现的attemptAuthentication(HttpServletRequest, HttpServletResponse)方法实现
    
    认证成功
        若认证成功,其结果对象(Authentication)将置于当前线程的SecurityContext中,以保证由更早的filter完成建立。
        配置setAuthenticationSuccessHandler(AuthenticationSuccessHandler)将被调用,将重定向到适当的目的地成功后登陆。
        默认的行为在SavedRequestAwareAuthenticationSuccessHandler实现,将利用任何DefaultSavedRequest设置经过ExceptionTranslationFilter和将用户重定向到包含其中的URL。
        不然,它将重定向到webapp根"/"。经过注入一个该类不一样的一个实现来定制该行为,or使用不一样的实现。
    
    认证失败
        若认证失败,它将委托到配置AuthenticationFailureHandler上,容许失败的信息传达到client上。
        默认实现SimpleUrlAuthenticationFailureHandler,发送401的错误码到client,它也可使用一个失败的URL进行配置,你能够注入任何行为须要在这里。
    
    事件的发布
        若是认证成功,一个InteractiveAuthenticationSuccessEvent经过application context发布,若认证不成功,没有事件发布,由于这一般会被记录由AuthenticationManager指定application event
    
    Session认证
        SessionAuthenticationStrategy一个可选,在一个成功调用attemptAuthentication方法后当即被调用
        不一样的实现能够注入,如防止固定session的攻击or并发Session的数量
        
org.springframework.security.authentication.AuthenticationProvider
    代表一个类能处理一个指定org.springframework.security.core.Authentication的实现
    
org.springframework.security.core.userdetails.AuthenticationUserDetailsService
    容许基于一个Authentication对象检索一个UserDetails对象
    
org.springframework.security.core.userdetails.UserDetailsService
    核心接口加载特定于用户的数据,做为整个框架的用户DAO和由DaoAuthenticationProvider使用策略浏览器

org.springframework.security.core.GrantedAuthority
    代码一个权力授予一个Authentication对象安全

org.springframework.security.access.intercept.AbstractSecurityInterceptor
 为安全对象实现安全拦截的抽象类。该类将保证适当的启动安全拦截的启动配置,也实现了适当的安全对象调用,即:
 从SecurityContextHolder对象中得到Authentication对象
 若请求依赖一个安全or在SecurityMetadataSource对象上经过查找安全对象的请求一个公开调用
 做为一个安全的调用
 若isAuthenticated返回false,或者alwaysReauthenticate是true,根据配置认证请求(AuthenticationManager),当认证后,使用返回的值替换SecurityContextHolder上的Authentication对象
 根据配置受权请求(AccessDecisionManager)
 执行任何run-as替换经过配置(RunAsManager)
 传达控制到具体的子类,将使用执行对象进行具体处理。一个InterceptorStatusToken对象返回在子类完成处理以后,它的finally clause能保证AbstractSecurityInterceptor是可从新调用和正确使用finallyInvocation
 子类可从新调用AbstractSecurityInterceptor经过afterInvocation方法
 若RunAsManager取代Authentication对象,返回SecurityContextHolder到调用AuthenticationManager后已存在的对象
 若一个AfterInvocationManager定义,调用该调用管理并容许它替换对象将被返回给调用者
 控制再次返回到具体的子类,随着被返回到调用者的对象,子类将原调用者返回的结果或异常
session

相关文章
相关标签/搜索