Skip to content

Bookstack OIDC fail to login with a empty groups claims #5101

Closed
@Misaka-L

Description

@Misaka-L

Describe the Bug

If the roles field in the response of the OIDC system is a empty array and user try to login without exist user in bookstack, they will get this error:

5df29eb4ce027e79cbcea686dab12f99

Steps to Reproduce

  1. Return a empty groups claims in OIDC user response
  2. Try to login without exist user in bookstack
  3. Throw error

Expected Behaviour

User login success and create a new bookstack account with a default role if the groups claims is empty (it should can be config by editing .env or web ui?).

Screenshots or Additional Context

OIDC User info dump

{
    "sub": "****",
    "name": "****",
    "picture": null,
    "updated_at": 1719400164865,
    "username": "****",
    "created_at": 1719398180979,
    "email": "****@****.com",
    "email_verified": true,
    "roles": [],
    "at_hash": "****",
    "aud": "ja7i8qdjfsn6asiwlce4o",
    "exp": 1720193283,
    "iat": 1720189683,
    "iss": "https://****/oidc"
}

.env

AUTH_METHOD=oidc

AUTH_AUTO_INITIATE=true

OIDC_NAME=****
OIDC_DISPLAY_NAME_CLAIMS=name

OIDC_CLIENT_ID=****
OIDC_CLIENT_SECRET=****

OIDC_ISSUER=https://****/oidc

OIDC_END_SESSION_ENDPOINT=true
OIDC_ISSUER_DISCOVER=true

OIDC_USER_TO_GROUPS=true
OIDC_GROUPS_CLAIM=roles
OIDC_ADDITIONAL_SCOPES=roles
OIDC_REMOVE_FROM_GROUPS=true

OIDC_DUMP_USER_DETAILS=false

5df29eb4ce027e79cbcea686dab12f99

Browser Details

Microsoft Edge 127.0.2651.15 Beta (64-bit) on Windows 11 24H2 (26120.961)

Exact BookStack Version

v24.05.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions