/u01/app/workflow/server/apache-tomcat-9.0.24/webapps/engine-rest/WEB-INF/web.xml

<filter>
  <filter-name>camunda-auth</filter-name>
  <filter-class>
    org.camunda.bpm.engine.rest.security.auth.ProcessEngineAuthenticationFilter
  </filter-class>
  <async-supported>true</async-supported>
  <init-param>
    <param-name>authentication-provider</param-name>
    <param-value>org.camunda.bpm.engine.rest.security.auth.impl.HttpBasicAuthenticationProvider</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>camunda-auth</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

发送请求时设置header

Authorization,其值为:

<script>
function authenticateUser(user, password) {
        var token = user + ":" + password;
        var hash = btoa(token); 
        return "Basic " + hash;
    }

alert(authenticateUser('demo','demo')) ;

</script>
  • No labels