Fiware-如何将PEP代理连接到Orion并使用HTTPS进行配置?

问题描述:

我正在与Orion合作,我尝试使用PEP代理和Keyrock保护未来的应用程序,但是我找不到结合这3个GE的方法.我的所有基本文件都在此存储库中,尽管我运行的是Orion,Keyrock和Cygnus,但我不能通过canbot发送使用PEP代理请求.

I am working with Orion and I try to protect the future apps using the PEP proxy and Keyrock, but I cannot find a way combine these 3 GE. All my base files are in this repository, although I have running Orion, Keyrock and Cygnus, I cannbot send requests using the PEP proxy.

这是我的docker-compose.yml文件:

This is my docker-compose.yml file:

version: "2"
networks:
  fiware:
    driver: bridge
services:
# Base de datos Orion
  mongodb:
    image: mongo:3.4.7
    hostname: mongodb
    container_name: mongodb
    expose:
      - "27017"
    ports:
      - "27018:27017"
    command: --smallfiles
    networks:
      - fiware
# GE encargado de la publicación y suscripción
  orion:
    image: fiware/orion:latest
    hostname: orion
    container_name: orion
    links: 
      - mongodb
    expose:
      - "1026"
    ports:
      - "1026:1026"
    volumes:
      - "./data/db/mongo:/data/db:rw" 
    command: -dbhost mongodb
    networks:
      - fiware
# GE encargada de la persistencia de datos
  cygnus:
    image: fiware/cygnus-ngsi:latest
    hostname: cygnus
    container_name: cygnus
    volumes:
      - "./config/cygnus/agent.conf:/opt/apache-flume/conf/agent.conf:rw"
      - "./config/cygnus/grouping_rules.conf:/opt/apache-flume/conf/grouping_rules.conf:rw"
    links:
      - mysql-cygnus
    expose:
      - "5050"
      - "8081"
    ports:
      - "5050:5050"
      - "8081:8081"
    environment:
      - CYGNUS_MYSQL_HOST=mysql-cygnus
      - CYGNUS_MYSQL_PORT=3306
      - CYGNUS_MYSQL_USER=root
      - CYGNUS_MYSQL_PASS=fiware
      - CYGNUS_LOG_LEVEL=INFO
    networks:
      - fiware
# Base de datos para historicos
  mysql-cygnus:
    image: mysql
    hostname: mysql-cygnus
    container_name: mysql-cygnus 
    expose:
      - "3306"
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=fiware
    volumes:
      - "./data/db/mysql:/var/lib/mysql:rw"
    networks:
      - fiware
# GE de control de acceso 
  authzforce:
     image: fiware/authzforce-ce-server:release-5.4.1
     hostname: authzforce
     container_name: authzforce
     expose:
         - "8080" 
     ports: 
         - "8080:8080"
# GE encargado de la administración de seguridad
  keyrock:
    image: fiware/idm:latest
    hostname: keyrock
    container_name: keyrock
    volumes:
        - "./config/idm/keystone.db:/keystone/keystone.db:rw"
        - "./config/idm/local_settings.py:/horizon/openstack_dashboard/local/local_settings.py:rw"
        - "./config/idm/keystone.conf:/keystone/etc/keystone.conf:rw"
    links:
        - orion
    expose:  
        - "5000"
        - "8000"
    ports:
        - "5000:5000"
        - "8000:8000"
    networks:
        - fiware
# GE encargado del redireccionamiento
  pepwilma:
    image: ging/fiware-pep-proxy
    hostname: pepwilma
    container_name: pepwilma
    volumes:
        - "./config/pepproxy/config.js:/opt/fiware-pep-proxy/config.js:rw"
    links:
        - keyrock
        - orion
        - authzforce
    volumes_from:
        - keyrock
    expose:
        - "80"
    ports:
        - "80:80"
    networks:
- fiware

创建和获取令牌,如您在下一个Wiki中所见:

Creating and getting the token as you can see in the next wiki: get token.

您可以在这里看到:令牌.

我无法继续,因为当我向以下人员提出请求时,PEP代理显示错误:邮递员请求(未指定端口).

I cannot continue because PEP proxy shows an error when I make the request to: postman request (without specifying a port).

使用此config.js: config.js .

using this config.js: config.js.

得到此错误:错误.

ERROR: Server - Caught exception: SyntaxError: Unexpected token E

有人提出建议,有人知道我该如何部署https支持?

someone have a suggestion, and someone knows how can I deploy the https support?

感谢所有...

您面临的问题是:在请求标头中找不到Auth-token".这意味着您没有在请求的标头中传递身份验证令牌.

The problem you are facing is: "Auth-token not found in request header". This means that you are not passing an auth-token in the headers of your request.

要解决您的问题,您需要通过以下方式获取有效令牌:

To solve your problem, you need to get a valid token this way:

POST to "http://idm_ip:8000/oauth2/token"  
Payload: grant_type=password&username=YOUR_USERNAME&password=YOUR_PASSWORD&cli ent_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET
Headers: 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic AUTH_HEADER'

将"idm_ip"和所有"YOUR _..."更改为正确的值.必须将AUTH_HEADER更改为此信息的Base64编码:"client_id:client_secret"-类似于base64(client_id + : + client_secret).

Change "idm_ip" and all "YOUR_..." to your correct values. AUTH_HEADER must be changed to a Base64 encode of this information: "client_id:client_secret" - something like base64(client_id + ":" + client_secret).

使用收到的令牌,您可以执行GET/POST请求,通知标头,如下所示:

With the received token, you can do your GET/POST request informing the headers as follow:

Headers: 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': 'your received IdM token' 

您可以在有关Orion的教程中找到更多信息, Keyrock和Wilma集成.