From ff13df03acb5b12be74b01d96c942ecb9af55672 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Wed, 6 Aug 2008 00:21:46 +0000 Subject: [PATCH] SEC-910: More updates to namespace appendix --- src/docbkx/appendix-namespace.xml | 289 ++++++++++++++++++++++++++---- 1 file changed, 252 insertions(+), 37 deletions(-) diff --git a/src/docbkx/appendix-namespace.xml b/src/docbkx/appendix-namespace.xml index a1c6d3e0a1..ffa7f775d1 100644 --- a/src/docbkx/appendix-namespace.xml +++ b/src/docbkx/appendix-namespace.xml @@ -1,29 +1,30 @@ The Security Namespace - + - This provides a reference to the elements available in the security namespace and information on - the underlying beans they create (a knowledge of the individual classes and how they work together is assumed - - you can find more information in the project Javadoc and elsewhere in this document). - If you haven't used the namespace before, please read the - introductory chapter. Using a good quality XML editor while - editing a configuration based on the schema is recommended as this will provide contextual information on - which elements and attributes are available and comments explaining their purpose. + This appendix provides a reference to the elements available in the security namespace and information on + the underlying beans they create (a knowledge of the individual classes and how they work together is assumed - + you can find more information in the project Javadoc and elsewhere in this document). + If you haven't used the namespace before, please read the + introductory chapter on namespace configuration, + as this is intended as a supplement to the information there. Using a good quality XML editor while editing a + configuration based on the schema is recommended as this will provide contextual information on which elements + and attributes are available as well as comments explaining their purpose. - +
The <literal><http></literal> Element This element encapsulates the security configuration for the web layer of your application. It creates a FilterChainProxy bean named "springSecurityFilterChain" which maintains the stack of - security filters which make up the web security configuration See the - introductory chapter for how to set up the mapping from + security filters which make up the web security configuration See the + introductory chapter for how to set up the mapping from your web.xml. Some core filters are always created and others will be added to the stack depending on the attributes child elements which are present. The positions of the standard filters are fixed (see the filter order table in the namespace introduction), @@ -31,12 +32,17 @@ filter chain explicitly in theFilterChainProxy bean. You can, of course, still do this if you need full control of the configuration. + + All filters which require a reference to the AuthenticationManager will be automatically + injected with the internal instance created by the namespace configuration (see the + introductory chapter for more on the AuthenticationManager). + The <http> namespace block always creates an HttpSessionContextIntegrationFilter, an ExceptionTranslationFilter and a FilterSecurityInterceptor. These are fixed and cannot be replaced with alternatives. - +
<literal><http></literal> Attributes @@ -46,9 +52,9 @@
<literal>servlet-api-provision</literal> - Provides versions of HttpServletRequest security methods such as + Provides versions of HttpServletRequest security methods such as isUserInRole() and getPrincipal() which are implemented by - adding a SecurityContextHolderAwareRequestFilter bean to the stack. Defaults to "true". + adding a SecurityContextHolderAwareRequestFilter bean to the stack. Defaults to "true".
@@ -63,16 +69,16 @@
<literal>lowercase-comparisons</literal> - Whether test URLs should be converted to lower case prior to comparing with defined path patterns. If unspecified, + Whether test URLs should be converted to lower case prior to comparing with defined path patterns. If unspecified, defaults to "true"
- +
<literal>session-fixation-protection</literal> - Indicates whether an existing session should be invalidated when a user authenticates and a new session started. - If set to "none" no change will be made. "newSession" will create a new empty session. + Indicates whether an existing session should be invalidated when a user authenticates and a new session started. + If set to "none" no change will be made. "newSession" will create a new empty session. "migrateSession" will create a new session and copy the session attributes to the new session. Defaults to "migrateSession". @@ -80,7 +86,7 @@ options on namespace-created instances of AbstractProcessingFilter will also be set appropriately.
- +
<literal>realm</literal> @@ -92,50 +98,259 @@
<literal>entry-point-ref</literal> - Normally the AuthenticationEntryPoint used will be set depending on which - authentication mechanisms have been configured. This attribute allows this behaviour to be overridden + Normally the AuthenticationEntryPoint used will be set depending on which + authentication mechanisms have been configured. This attribute allows this behaviour to be overridden by defining a customized AuthenticationEntryPoint bean which will start the authentication process.
- +
<literal>access-decision-manager-ref</literal> - Optional attribute specifying the ID of the AccessDecisionManager implementation which should be + Optional attribute specifying the ID of the AccessDecisionManager implementation which should be used for authorizing HTTP requests. By default an AffirmativeBased implementation is used for with a RoleVoter and an AuthenticatedVoter.
- +
<literal>access-denied-page</literal> - Allows the access denied page to be set (the user will be redirected here if an AccessDeniedException is raised). + Allows the access denied page to be set (the user will be redirected here if an + AccessDeniedException is raised). Corresponds to the + errorPage property set on the AccessDeniedHandlerImpl which is + used by the ExceptionTranslationFilter.
<literal>once-per-request</literal> - Corresponds to the observeOncePerRequest property of + Corresponds to the observeOncePerRequest property of FilterSecurityInterceptor. Defaults to "true".
-
- - - - - +
The <literal><intercept-url></literal> Element - - + + This element is used to define the set of URL patterns that the application is interested in + and to configure how they should be handled. It is used to construct the + FilterInvocationDefinitionSource used by the FilterSecurityInterceptor and + to exclude particular patterns from the filter chain entirely (by setting the attribute filters="none"). + It is also responsible for configuring a ChannelProcessingFilter if particular URLs need to be accessed + by HTTPS, for example. + + +
+ <literal>pattern</literal> + + The pattern which defines the URL path. The content will depend on the path-type attribute from the + containing http element, so will default to ant path syntax. + +
+
+ <literal>method</literal> + + The HTTP Method which will be used in combination with the pattern to match an incoming request. If omitted, any method will match. + +
+
+ <literal>access</literal> + + Lists the access attributes which will be stored in the FilterInvocationDefinitionSource for the defined + URL pattern/method combination. This should be a comma-separated list of the attributes (such as role names). + +
+
+ <literal>requires-channel</literal> + + Can be "http" or "https" depending on whether a particular URL pattern should be accessed over HTTP or HTTPS respectively. Alternatively + the value "any" can be used when there is no preference. If this attribute is present on any <intercept-url> + element, then a ChannelProcessingFilter will be added to the filter stack and its additional dependencies added + to the application context. See the chapter on channel security for an + example configuration using traditional beans. + + + If a <port-mappings> configuration is added, this will be used to by the SecureChannelProcessor + and InsecureChannelProcessor beans to determine the ports used for redirecting to HTTP/HTTPS. + +
+
+ The <literal><port-mappings></literal> Element + + By default, an instance of PortMapperImpl will be added to the configuration for use in redirecting + to secure and insecure URLs. This element can optionally be used to override the default mappings which that class defines. Each + child <port-mapping> element defines a pair of HTTP:HTTPS ports. The default mappings are 80:443 + and 8080:8443. An example of overriding these can be found in the namespace introduction. + +
+ +
+ The <literal><form-login></literal> Element + + Used to add an AuthenticationProcessingFilter to the filter stack and an + AuthenticationProcessingFilterEntryPoint to the application context to provide authentication + on demand. This will always take precedence over other namespace-created entry points. + If no attributes are supplied, a login page will be generated automatically at the URL "/spring-security-login" + This feature is really just provided for convenience and is not intended for production (where a + view technology will have been chosen and can be used to render a customized login page). The class + DefaultLoginPageGeneratingFilter is responsible for rendering the login + page and will provide login forms for both normal form login and/or OpenID if required. + The behaviour can be customized using the following attributes. + + +
+ <literal>login-page</literal> + + The URL that should be used to render the login page. Maps to the loginFormUrl + property of the AuthenticationProcessingFilterEntryPoint. Defaults to + "/spring-security-login". + +
+ +
+ <literal>login-processing-url</literal> + + Maps to the filterProcessesUrl property of AuthenticationProcessingFilter. + The default value is "/j_spring_security_check". + +
+ +
+ <literal>default-target-url</literal> + Maps to the defaultTargetUrl property of AuthenticationProcessingFilter. If + not set, the default value is "/" (the application root). A user will be taken to this URL after logging in, provided they + were not asked to login while attempting to access a secured resource, when they will be taken to the originally requested URL. + +
+ +
+ <literal>always-use-default-target</literal> + + If set to "true", the user will always start at the value given by default-target-url, regardless of how + they arrived at the login page. Maps to the alwaysUseDefaultTargetUrl property of + AuthenticationProcessingFilter. Default value is "false". + +
+ +
+ <literal>authentication-failure-url</literal> + + Maps to the authenticationFailureUrl property of AuthenticationProcessingFilter. + Defines the URL the browser will be redirected to on login failure. Defaults to "/spring_security_login?login_error", which will + be automatically handled by the automatic login page generator, re-rendering the login page with an error message. + +
+
+
+ The <literal><http-basic></literal> Element + + Adds a BasicProcessingFilter and BasicProcessingFilterEntryPoint to the + configuration. The latter will only be used as the configuration entry point if form-based login is not enabled. + +
+ +
+ The <literal><remember-me></literal> Element + + Adds the RememberMeProcessingFilter to the stack. This in turn will + be configured with either a TokenBasedRememberMeServices, a PersistentTokenBasedRememberMeServices + or a user-specified bean implementing RememberMeServices depending on the attribute settings. + +
+ <literal>data-source-ref</literal> + + If this is set, PersistentTokenBasedRememberMeServices will be used and configured with + a JdbcTokenRepositoryImpl instance. + +
+ +
+ <literal>token-repository-ref</literal> + + Configures a PersistentTokenBasedRememberMeServices but allows the use of a custom + PersistentTokenRepository bean. + +
+ +
+ <literal>services-ref</literal> + + Allows complete control of the RememberMeServices implementation that will be used + by the filter. The value should be the Id of a bean in the application context which implements this interface. + +
+ +
+ <literal>token-repository-ref</literal> + + Configures a PersistentTokenBasedRememberMeServices but allows the use of a custom + PersistentTokenRepository bean. + +
+ +
+ The <literal>key</literal> Attribute + Maps to the "key" property of AbstractRememberMeServices. Should be set to a unique + value to ensure that remember-me cookies are only valid within the one application This doesn't affect + the use of PersistentTokenBasedRememberMeServices, where the tokens are stored on the server side.. + +
+ +
+ <literal>token-validity-seconds</literal> + + Maps to the tokenValiditySeconds property of AbstractRememberMeServices. Specifies the period + in seconds for which the remember-me cookie should be valid. By default it will be valid for 14 days. + +
+ +
+ <literal>user-service-ref</literal> + + The remember-me services implementations require access to a UserDetailsService, so there has to be + one defined in the application context. If there is only one, it will be selected and used automatically by the namespace configuration. + If there are multiple instances, you can specify a bean Id explicitly using this attribute. + +
+
+ +
+ The <literal><concurrent-session-control></literal> Element + + +
+ +
+ The <literal><anonymous></literal> Element + + +
+ +
+ The <literal><x509></literal> Element + + +
+ +
+ The <literal><openid-login></literal> Element + + +
+ +
+ The <literal><logout></literal> Element + + +
+
- - \ No newline at end of file + +