Open alamakih opened 6 years ago
I am not fully sure if it works for JDBCRealm as well but have a look at this example. You can define users with roles.
Figured it out. Realm configuration can be done in [webapp]/META-INF/context.xml, so no need for server.xml. Now if I'd just get webapp dir working from "foo/WebContent" instead of "src/main/webapp".
The configuration of foo/WebContent
is specific to the war
plugin so you'll need to check its documentation.
Hello, project's maintainer! Thank you for your great work. I am setting up authentication using Basic authentication, servlet, and the Gradle Tomcat Plugin. But it does not work. I defined user roles in web.xml, and here is my tomcat section in build.gradle:
tomcat {
httpProtocol = 'org.apache.coyote.http11.Http11Nio2Protocol'
ajpProtocol = 'org.apache.coyote.ajp.AjpNio2Protocol'
contextPath = '/'
users {
user {
username = 'user1'
password = '123456'
roles = ['admin']
}
user {
username = 'user2'
password = 'abcdef'
roles = ['user']
}
}
}
When I entering the correct credential in the pop-up asking for login and password, the site still doesn't let me log in, the pop-up will raise again. Please help me get it to work correctly. Thank you
I have a webapp that does form based authentication against JDBCRealm, which is normally configured in server.xml. Is there some way to get the authentication working in tomcat-plugin?