I try to protect one page from webapp with Tomcat authorization and login form. I write url-pattern from page which I want to protect. this is code
<servlet-mapping>
<servlet-name>uploadFile</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<security-role>
<role-name>user</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>adminpage</web-resource-name>
<url-pattern>/resources/html/adminpage.html</url-pattern>
<!-- <url-pattern>/*</url-pattern> this is work if I wont to security all aplication
I get login page and I can success login-->
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
When I try to go on this url-address, I got login page for login ....
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/resources/html/login.html</form-login-page>
<form-error-page>/resources/html/logout.html</form-error-page>
</form-login-config>
</login-config>
And problem is, when I success login , tomcat send me on this url-address , which is not exist:
http://localhost:8080/fileupload/resources/html/adminpage.html
I want to go on this adress after login:
http://localhost:8080/fileupload/#/adminpage
If the url-paterrn enrollment /adminpage.html, then tomcat does't protect any pages, only the url-pattern that I wrote, the login page show when I want to access adminpage.html page. What I doing wrong ? I use angularJS, Spring and Maven. This is angular app.js config :
uploadFile.config(['$routeProvider','$locationProvider', function($routeProvider,$locationProvider) {
$routeProvider
.when('/', {
templateUrl : 'resources/html/home.html',
controller : 'uploadFileController'
})
.when('/adminpage', {
templateUrl : 'resources/html/adminpage.html',
controller : 'uploadFileControllerAdmin'
})
.when('/logout', {
templateUrl : 'resources/html/logout.html',
controller : 'uploadFileControllerAdmin'
})
.otherwise({
redirectTo: '/'
});
Aucun commentaire:
Enregistrer un commentaire