Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I will leave how to inject your own custom authentication provider to the other myriad of examples from <a href="http://www.google.com/search?q=spring+security+custom+authentication+provider&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a" rel="nofollow noreferrer">Googleland</a> and here on <a href="https://stackoverflow.com/questions/448204/creating-a-custom-authentication-with-acegi-spring-security">StackOverflow</a>. It looks like it has to do with marking a particular bean with the xml. But hopefully I can fill in some of the other details for you.</p> <p>So you've defined the class somewhat like above and I'll add more of the details that you'll need for Spring (i.e. merge the stuff from above as well.</p> <pre><code>public class SwitchingAuthenticationProvider implements AuthenticationProvider { .... public List&lt;AuthenticationProvider&gt; getProviders() { return delegateList; } public void setProviders(List&lt;AuthenticationProvider&gt; providers) { this.delegateList = providers; } .... } </code></pre> <p>This will allow you to inject a host of providers using spring:</p> <pre><code>&lt;bean id="customAuthProvider1" class=".....CustomProvider1"&gt; ... &lt;/bean&gt; &lt;bean id="customAuthProvider2" class=".....CustomProvider2"&gt; ... &lt;/bean&gt; ... &lt;bean id="customAuthProviderX" class=".....CustomProviderX"&gt; ... &lt;/bean&gt; &lt;bean id="authenticationProvider" class="....SwitchingAuthenticationProvider"&gt; &lt;security:custom-authentication-provider/&gt; &lt;!-- using property injection (get/setProviders) in the bean class --&gt; &lt;property name="providers"&gt; &lt;list&gt; &lt;ref local="customAuthProvider1"/&gt; &lt;!-- Ref of 1st authenticator --&gt; &lt;ref local="customAuthProvider2"/&gt; &lt;!-- Ref of 2nd authenticator --&gt; ... &lt;ref local="customAuthProviderX"/&gt; &lt;!-- and so on for more --&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>In the end how you populate the providers could be any means of getting the delegator a collection of providers. How they map up to which one to use is up to you. The collection could be a named mapped, based on the current state of the delegator. It could be a list of more than one to try. It could be two properties, "get/setPrimary" and "get/setSecondary" for fail-over like functionality. Once you have the delegator injected the possibilities are up to you.</p> <p>Let me know if this isn't answering your question.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload