obiba / docker-opal

GNU General Public License v3.0
7 stars 11 forks source link

Authentication failed #17

Closed serdar- closed 2 years ago

serdar- commented 2 years ago

I used the docker compose file provided in the documentation, which is as follows:

version: '3'
services:
  opal:
    image: obiba/opal:latest
    ports:
      - "8843:8443"
      - "8880:8080"
    links:
      - rock
      - mongo
      - mysqldata
    environment:
      - JAVA_OPTS=-Xms1G -Xmx8G -XX:+UseG1GC
      - OPAL_ADMINISTRATOR_PASSWORD=password
      - MONGO_HOST=mongo
      - MONGO_PORT=27017
      - MYSQLDATA_HOST=mysqldata
      - MYSQLDATA_USER=opal
      - MYSQLDATA_PASSWORD=password
      - ROCK_HOSTS=rock:8085
    volumes:
      - /tmp/opal:/srv
  mongo:
    image: mongo
  mysqldata:
    image: mysql:5
    environment:
      - MYSQL_DATABASE=opal
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_USER=opal
      - MYSQL_PASSWORD=password
  rock:
    image: obiba/rock:latest

However, when I try to login after composing the image (using port 8880 because 8443 does not work at all), I get Authentication failed error. The response from server is: {"code": 500,"status": "UnhandledException","arguments": ["NotAllowedException","No resource method found for GET, return 405 with Allow header"]}

When I check the logs I see the following:

2022-01-05 12:31:00,285 [qtp1984134811-50] WARN  org.obiba.opal.web.security.CSRFInterceptor - CSRF detection: Host=localhost:8880, Referer=http://localhost:8880/ui/index.html
2022-01-05 12:31:00,285 [qtp1984134811-313] WARN  org.obiba.opal.web.security.CSRFInterceptor - CSRF detection: Host=localhost:8880, Referer=http://localhost:8880/ui/index.html
2022-01-05 12:31:07,848 [qtp1984134811-47] WARN  org.obiba.opal.web.security.CSRFInterceptor - CSRF detection: Host=localhost:8880, Referer=http://localhost:8880/ui/index.html

First of all, do you have any clue on why port 8443 does not work at all? Could this be caused by the fact that I try to login using the port 8880?

Many thanks in advance for your input!

kazoompa commented 2 years ago

Hi Serdar,

Did you try to use the port 8843?

Another quick workaround is to change the docker-compose file and use:

    ports:
      - "8443:8443"
      - "8080:8080"

Given that these ports are not already in use.

The last solution is to create a volume for your Opal service and make sure that the port numbers match the ones in your docker-compose:

Once the Opal container is created and running, go to Opal volume and under /conf folder edit the file `opal-config.properties and update the ports as follows:

# Port number for HTTP(s) connections
# Default: 8080 (http), 8443 (https)
# Uncomment the following line(s) to set a different value (set to -1 to disable)
org.obiba.opal.http.port=8880
org.obiba.opal.https.port=8843

Make sure to restart the container:

cd <docker-compose-folder>
docker-compose restart opal

My suggestion is to use the quick solution and use the default ports (8443,8080) if those ports are free.

Best,

serdar- commented 2 years ago

Dear @kazoompa, thanks for your quick response!

I tried your suggestions. Apparently there is a problem with port forwarding, at the moment port 8080 does work but 8443 does not.

kazoompa commented 2 years ago

Did you try the 8443 with https?

serdar- commented 2 years ago

Yes, 8443 works with https! Thanks! I thought browser would automatically open the https page but apparently I had to write it explicitly. Although I still wonder why the port forwarding fails...