SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
805 stars 171 forks source link

Eliminate default authentication #320

Closed fdrsuisse closed 5 years ago

fdrsuisse commented 5 years ago

Hi, in order to use the APIs the default authentication in the file etc/security.yml is admin/changeit , according to the link https://softinstigate.atlassian.net/wiki/spaces/RH/pages/13369378/Enable+and+Configure+Security Is it possible to eliminate the default authentication ? Best Regards, Francesco

ujibang commented 5 years ago

Hi Francesco,

yes you can obviously remove the admin user from the security.yml file.

You can also disable or replace the authentication manager implementation with the following configuration option:

idm:    
    implementation-class: org.restheart.security.impl.SimpleFileIdentityManager
    conf-file: ./etc/security.yml

Please note that the documentation on confluence https://softinstigate.atlassian.net/ is deprecated. For updated documentation, always refer to https://restheart.org/learn/

fdrsuisse commented 5 years ago

Hi Andrea I removed the admin user from the "security.yml" file. users:

- userid: user
  password: changeit
  roles: [users]
- userid: user2
  password: changeit
  roles: [users]

In the "restheart.yml" :

http-listener: true http-host: 10.4.17.205 http-port: 8080

In the "restheart.yml" I have the section: idm: implementation-class: org.restheart.security.impl.SimpleFileIdentityManager conf-file: ./etc/security.yml
When I launch : curl -i 'http://10.4.17.205:8080/sth_carouge/sth_x002ftpg?count' HTTP/1.1 401 Unauthorized Connection: keep-alive Thanks in advance, Francesco

ujibang commented 5 years ago

if you want no authorization (all requests are executed) just comment out idm and am sections from configuration file

fdrsuisse commented 5 years ago

Hi Andrea, many thanks for your support. It works. You can close the issue. Best Regards, Francesco