siteminder-auth-provider.xml 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="siteminder"><info><title>Siteminder Authentication Mechanism</title></info>
  2. <section xml:id="siteminder-overview"><info><title>Overview</title></info>
  3. <para>Siteminder is a commercial single sign on solution by Computer
  4. Associates.</para>
  5. <para>Spring Security provides a filter,
  6. <literal>SiteminderAuthenticationProcessingFilter</literal> and
  7. provider, <literal>SiteminderAuthenticationProvider</literal> that can
  8. be used to process requests that have been pre-authenticated by
  9. Siteminder. This filter assumes that you're using Siteminder for
  10. <emphasis>authentication</emphasis>, and that you're using Spring
  11. Security for <emphasis>authorization</emphasis>. The use of Siteminder
  12. for <emphasis>authorization</emphasis> is not yet directly supported
  13. by Spring Security.</para>
  14. <para>When using Siteminder, an agent is setup on your web server to
  15. intercept a principal's first call to your application. The agent
  16. redirects the web request to a single sign-on login page, and once
  17. authenticated, your application receives the request. Inside the HTTP
  18. request is a header - such as <literal>SM_USER</literal> - which
  19. identifies the authenticated principal (please refer to your
  20. organization's "single sign-on" group for header details in your
  21. particular configuration).</para>
  22. </section>
  23. <section xml:id="siteminder-config"><info><title>Configuration</title></info>
  24. <para>The first step in setting up Spring Security's Siteminder
  25. support is to define the authentication mechanism that will inspect
  26. the HTTP header discussed earlier. It will be responsible for
  27. generating a <literal>UsernamePasswordAuthenticationToken</literal>
  28. that is later sent to the
  29. <literal>SiteminderAuthenticationProvider</literal>. Let's look at an
  30. example:</para>
  31. <para><programlisting>&lt;bean id="authenticationProcessingFilter"
  32. class="org.springframework.security.ui.webapp.SiteminderAuthenticationProcessingFilter"&gt;
  33. &lt;property name="authenticationManager"&gt;&lt;ref bean="authenticationManager"/&gt;&lt;/property&gt;
  34. &lt;property name="authenticationFailureUrl"&gt;&lt;value&gt;/login.jsp?login_error=1&lt;/value&gt;&lt;/property&gt;
  35. &lt;property name="defaultTargetUrl"&gt;&lt;value&gt;/security.do?method=getMainMenu&lt;/value&gt;&lt;/property&gt;
  36. &lt;property name="filterProcessesUrl"&gt;&lt;value&gt;/j_spring_security_check&lt;/value&gt;&lt;/property&gt;
  37. &lt;property name="siteminderUsernameHeaderKey"&gt;&lt;value&gt;SM_USER&lt;/value&gt;&lt;/property&gt;
  38. &lt;property name="formUsernameParameterKey"&gt;&lt;value&gt;j_username&lt;/value&gt;&lt;/property&gt;
  39. &lt;/bean&gt;</programlisting></para>
  40. <para>In our example above, the bean is being provided an
  41. <literal>AuthenticationManager</literal>, as is normally needed by
  42. authentication mechanisms. Several URLs are also specified, with the
  43. values being self-explanatory. It's important to also specify the HTTP
  44. header that Spring Security should inspect. If you additionally want
  45. to support form-based authentication (i.e. in your development
  46. environment where Siteminder is not installed), specify the form's
  47. username parameter as well - just don't do this in production!</para>
  48. <para>Note that you'll need a
  49. <literal>SiteminderAuthenticationProvider</literal>
  50. configured against your <literal>ProviderManager</literal> in order to
  51. use the Siteminder authentication mechanism. Normally an
  52. <literal>AuthenticationProvider</literal> expects the password
  53. property to match what it retrieves from the
  54. <literal>UserDetailsSource</literal>, but in this case, authentication
  55. has already been handled by Siteminder, so password property is not
  56. even relevant. This may sound like a security weakness, but remember
  57. that users have to authenticate with Siteminder before your
  58. application ever receives the requests, so the purpose of your custom
  59. <literal>UserDetailsService</literal> should simply be to build the
  60. complete <literal>Authentication</literal> object (ie with suitable
  61. <literal>GrantedAuthority[]</literal>s).</para>
  62. <para>Advanced tip and word to the wise: If you additionally want to
  63. support form-based authentication in your development environment
  64. (where Siteminder is typically not installed), specify the form's
  65. username parameter as well. Just don't do this in production!</para>
  66. </section>
  67. </chapter>