casdoor / casdoor

An open-source UI-first Identity and Access Management (IAM) / Single-Sign-On (SSO) platform with web UI supporting OAuth 2.0, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, RADIUS, Google Workspace, Active Directory and Kerberos
https://casdoor.org
Apache License 2.0
9.21k stars 1.09k forks source link

Cannot delete sessionId in DB when recreate `casdoor` #2928

Closed ladung closed 1 month ago

ladung commented 1 month ago

image

casbin-bot commented 1 month ago

@tangyang9464 @JalinWang @imp2002

hsluoyz commented 1 month ago

@ladung what did you do to see this? Reproduce steps?

ladung commented 1 month ago

@ladung what did you do to see this? Reproduce steps? @hsluoyz

  1. I start casdoor via docker-compose by command: docker-compose up -d. Login to casdoor in web, show session on tab session
  2. I remove casdoor by run docker-compose down
  3. recreate casdoor by command : docker-compose up -d

My compose file:

version: "3"
services:
  casdoor:
    restart: always
    image: $CASDOOR_IMAGE_TAG
    entrypoint: /bin/sh -c './server --createDatabase=true'
    container_name: casdoor
    environment:
      RUNNING_IN_DOCKER: "true"
      DOMAIN: ${DOMAIN}
    ports:
     - "8080:8080"
    volumes:
      - ./app.conf:/conf/app.conf
      - ./init_data.json:/init_data.json
    networks:
      - backend 
    depends_on:
      postgres:
        condition: service_healthy

  redis:
    image: redis:7.2-alpine
    restart: always
    command: redis-server --maxmemory-policy allkeys-lru --maxmemory 200mb
    networks:
      backend:

  postgres:
    image: ${POSTGRES_IMAGE_TAG}
    volumes:
      - ./data/idp/idp-postgres:/var/lib/postgresql/data
      - ./bin/pg_multiple_databases:/docker-entrypoint-initdb.d
    environment:
      #POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_MULTIPLE_DATABASES: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    networks:
      - backend
    healthcheck:
      test: [ "CMD", "pg_isready", "-q", "-d", "${POSTGRES_DB}", "-U", "${POSTGRES_USER}" ]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 60s
    restart: always
    ports:
      - "5433:5432"
hsluoyz commented 1 month ago

@ladung it seems like a Docker container permission issue. Not a Casdoor issue

ladung commented 1 month ago

@ladung it seems like a Docker container permission issue. Not a Casdoor issue

@hsluoyz I use casdoor version 1.610.0

I double check it when recreate. I saw sessionId was not delete in DB tables. When create user from init_data.json, casdoor require delete sessionid as follow: https://github.com/casdoor/casdoor/blob/master/object/user.go#L922

If you restart through cmd docker-compose restart, you still have same error!

ladung commented 1 month ago

@hsluoyz
And when I delete sessionId in database table session, it's will be work fine! image

ladung commented 1 month ago

@hsluoyz here is my video https://drive.google.com/file/d/1vArYh7IwCuzCPkkAYvhUpGzw2c4D4Phs/view?usp=drive_link

ladung commented 1 month ago

@hsluoyz Please see issue soon!

ladung commented 1 month ago

hi @hsluoyz Have you seen that?

dacongda commented 1 month ago

sorry about that, we will solve this as soon as possible

dacongda commented 1 month ago

hi @hsluoyz Have you seen that?

btw, if you enable init data with init_data.json , it will execute when you restart / recreate the casdoor, plz make sure you disable it when you don't need it

casbin-bot commented 1 month ago

:tada: This issue has been resolved in version 1.611.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: