User authentication on a Jersey REST service

前端 未结 5 1073
孤街浪徒
孤街浪徒 2020-11-27 12:40

I am developing a REST application, which is using the Jersey framework. I would like to know how I can control user authentication. I have searched many places, and the clo

5条回答
  •  余生分开走
    2020-11-27 12:49

    I'm sucessfully using spring security for securing my Jersey-based API. It has pluggable authentication schemes allowing you to switch from Basic Auth to something else later. I'm not using Spring in general, just the security stuff.

    Here is the relevant part from my web.xml

    
        
            org.springframework.web.context.ContextLoaderListener
        
    
    
    
        contextConfigLocation
        
            /WEB-INF/security-applicationContext.xml,
            /WEB-INF/applicationContext.xml
        
    
    
    
    
    
        springSecurityFilterChain
        
            org.springframework.web.filter.DelegatingFilterProxy
        
        
            targetBeanName
            springSecurityFilterChain
        
    
    
    
        springSecurityFilterChain
        /*
    
    
    

    You can leave applicationContext.xml empty (). An example of the security-applicationContext.xml can be found here

提交回复
热议问题