-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
376 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Access a broker with Basic authentication | ||
|
||
This documentation explains how to access an Orion Context Broker that the endpoints of NGSI API | ||
are protected by Basic Authentication. | ||
|
||
## Add user | ||
|
||
Add username and password to the htpasswd file. | ||
|
||
``` | ||
NAME=fiware PASS='1234'; echo $NAME:`openssl passwd -6 $PASS` >> htpasswd | ||
``` | ||
|
||
## Start up | ||
|
||
Start up an Orion context broker. | ||
|
||
``` | ||
docker-compose up -d | ||
``` | ||
|
||
You can see three containers. | ||
|
||
``` | ||
Name Command State Ports | ||
-------------------------------------------------------------------------------------------------------- | ||
basic_authentication_mongo_1 docker-entrypoint.sh --noj ... Up 27017/tcp | ||
basic_authentication_nginx_1 /docker-entrypoint.sh ngin ... Up 0.0.0.0:80->80/tcp,:::80->80/tcp | ||
basic_authentication_orion_1 /usr/bin/contextBroker -fg ... Up 1026/tcp | ||
``` | ||
|
||
## Add the broker | ||
|
||
Add the broker to NGSI Go configuration. | ||
|
||
``` | ||
ngsi broker add \ | ||
--host orion-with-basic-auth \ | ||
--ngsiType v2 \ | ||
--brokerHost http://localhost/ \ | ||
--idmType basic \ | ||
--username fiware \ | ||
--password 1234 | ||
``` | ||
|
||
## Access the broker | ||
|
||
The following command allows you to access the broker with Basic authentication. | ||
|
||
``` | ||
ngsi version --host orion-with-basic-auth | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: "3" | ||
|
||
services: | ||
nginx: | ||
image: nginx:latest | ||
ports: | ||
- 80:80 | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf:ro | ||
- ./htpasswd:/etc/nginx/.htpasswd:ro | ||
depends_on: | ||
- orion | ||
|
||
orion: | ||
image: fiware/orion:3.1.0 | ||
depends_on: | ||
- mongo | ||
command: -dbhost mongo | ||
|
||
mongo: | ||
image: mongo:4.4 | ||
command: --nojournal |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
user nginx; | ||
worker_processes 1; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
|
||
server { | ||
listen 80; | ||
|
||
location / { | ||
auth_basic "Restricted"; | ||
auth_basic_user_file /etc/nginx/.htpasswd; | ||
|
||
proxy_pass http://orion:1026; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.