如何从angularJs 1.5.0调用camunda rest api并提供基本身份验证

时间:2016-03-16 10:25:01

标签: angularjs rest camunda

我是新的蜜蜂到camunda和角。我想在我的角应用程序中访问camunda Rest api服务。并希望在登录时提供基本身份验证。我尝试使用不同的方法。但是失败得到了CORS错误,401 404未经授权的错误 这是一个电话

 $http.post('http://192.168.100.107:8080/engine-rest',
                    { username: username, password: password })
                        .then(function successCallback(response) {
                            console.log(response);
                            console.log(JSON.stringify(response));
                            //callback(response);
                        // this callback will be called asynchronously
                        // when the response is available
                        }, function errorCallback(response) {
                            console.log(response);
                            console.log(JSON.stringify(response));
                            //callback(response);
                        // called asynchronously if an error occurs
                        // or server returns response with  

                        });

这是在camunda server engine-rest

中添加的cors过滤器
<filter>
    <filter-name>CacheControlFilter</filter-name>
    <filter-class>org.camunda.bpm.engine.rest.filter.CacheControlFilter</filter-class>    
  </filter>
  <filter-mapping>
    <filter-name>CacheControlFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <!-- Http Basic Authentication Filter -->
   <filter>
    <filter-name>camunda-auth</filter-name>
    <filter-class>
      org.camunda.bpm.engine.rest.security.auth.ProcessEngineAuthenticationFilter
    </filter-class>
    <init-param>
      <param-name>authentication-provider</param-name>
      <param-value>org.camunda.bpm.engine.rest.security.auth.impl.HttpBasicAuthenticationProvider</param-value>
    </init-param>
    <init-param>
        <param-name>rest-url-pattern-prefix</param-name>
        <param-value></param-value>
      </init-param> 
  </filter>

0 个答案:

没有答案