Results 1 to 4 of 4

Thread: Is there possibility to use Spring Security without it's authentification mechanism?

  1. #1
    Join Date
    Jan 2011
    Posts
    27

    Default Is there possibility to use Spring Security without it's authentification mechanism?

    I only need to secure URLs and methods.

    My application has own difficult authentification method, and I can simply set the SecurityContext in this method:

    Code:
    SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(user.getUsername(), user.getPassword(), authorities));
    Securing methods I guess is possible with such configurations:

    Code:
    <b:bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
             <filter-chain-map path-type="ant">
                <filter-chain pattern="/**" filters="securityContextPersistenceFilter"/>
            </filter-chain-map>
        </b:bean>
    
        <b:bean id="securityContextPersistenceFilter"
    class="org.springframework.security.web.context.SecurityContextPersistenceFilter"/>
    (Without any other filters.)

    But is there possibility to secure URLs without AuthenticationManager?

  2. #2
    Join Date
    Sep 2004
    Location
    Manchester, NH
    Posts
    1,236

    Default

    Sure, you could do this, but at that point, what value is Spring Security bringing vs just writing your own SecurityContextHolder etc.?

    Are you handling login, logout, redirect, and all the other security stuff yourself also?
    Peter Mularien | Blog
    Author, Spring Security 3 (Book) - Packt Publishing, Available in print and eBook form
    SCJP 5, Oracle DBA
    Any postings are my own opinion, and should not be attributed to my employer or clients.


  3. #3
    Join Date
    Jan 2011
    Posts
    27

    Default

    Quote Originally Posted by pmularien View Post
    Sure, you could do this, but at that point, what value is Spring Security bringing vs just writing your own SecurityContextHolder etc.?
    As I mentioned earlier, I want only simple mechanism for seruring URLs and methods.

    Are you handling login, logout, redirect, and all the other security stuff yourself also?
    I handle login, logout myself.

    I guess AuthenticationManager is used only for login? Or I mistake?
    Last edited by kostepanych; Jan 17th, 2011 at 06:58 AM.

  4. #4
    Join Date
    Jan 2008
    Posts
    1,834

    Default

    It sounds like you are already handling all of your authentication needs already and just want to use Spring Security for authorization. If this is the case, you might consider looking at the PreAuthentication Scenarios.
    Rob Winch
    Twitter @rob_winch
    Spring Security Lead
    Spring by Pivotal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •