Digest Authentication with CORS at Tomcat -


right building rest api running @ tomcat 8 using corsfilter of apache allow cross domain requests set @ web.xml that:

<filter>     <filter-name>corsfilter</filter-name>     <filter-class>org.apache.catalina.filters.corsfilter</filter-class> </filter> <filter-mapping>     <filter-name>corsfilter</filter-name>     <url-pattern>/webapi/*</url-pattern> </filter-mapping> 

so far easy wanted add digest authentication rest-api, yes digest not basic!

for simple usage wanted use security-constraints @ web.xml:

<security-constraint>     <web-resource-collection>         <web-resource-name>all</web-resource-name>         <url-pattern>/webapi/*</url-pattern>     </web-resource-collection>     <auth-constraint>         <role-name>*</role-name>     </auth-constraint> </security-constraint>  <login-config>     <auth-method>digest</auth-method>     <realm-name>userdatabase</realm-name> </login-config> 

the authentication , cors filter works fine on there own, here starts problem: security constraint executed servlet container before cors filter. authentication algorithm doesn't set needed cors(cross domain request headers) @ digest authentication headers, result cors-request fail @ authentication, because digest 401 page "challange"(nonce, qop, realm, etc.) missing necessary headers cross domain request. solution or implementation problem? or need implement own digest filter because of cors?!

you can try reimplement corsfilter tomcat valve , make sure configured run before digest authenticator valve.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -