How to programmatically setup a in Servlets 3.x?

前端 未结 3 394
春和景丽
春和景丽 2020-12-20 12:20

In my current web application I am trying to get rid of web.xml and I have not been able to properly setup the security constraint that forces all requests to the applicatio

3条回答
  •  一生所求
    2020-12-20 12:45

    I was able to do this for a project by configuring the glassfish domain security:

    1. Create a new security domain, in this example call it: FooRealm
    2. Add users w (or w/o) passwords to FooRealm
    3. Add each user to "GroupFoo"

    That covers your glassfish config, here is your web.xml:

    
        SecurityConstraint
        
            Everything
            Everything
            /*
        
        
            UserAuthenticationConstraint
            GroupFoo
        
    
    
        FORM
        FooRealm
        
            /Login.jsp
            /LoginError.html
        
    
    

提交回复
热议问题