Mix/combine AUTH_METHOD options #2224

Open
opened 2026-02-05 03:22:27 +03:00 by OVERLORD · 23 comments
Owner

Originally created by @pbordon on GitHub (Apr 27, 2021).

Exist the possibility to login in a mixed method: LDAP or simple user registration, defined by user?

Originally created by @pbordon on GitHub (Apr 27, 2021). Exist the possibility to login in a mixed method: LDAP or simple user registration, defined by user?
OVERLORD added the 🔨 Feature Request🚪 Authentication labels 2026-02-05 03:22:27 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Apr 30, 2021):

Hi @pbordon,
Would you be able to provide insight into the environment where you'd want this within and the benefits this would bring?

@ssddanbrown commented on GitHub (Apr 30, 2021): Hi @pbordon, Would you be able to provide insight into the environment where you'd want this within and the benefits this would bring?
Author
Owner

@pbordon commented on GitHub (May 3, 2021):

In my organization, we have internal users, connected to an AD and external users, which are many and vary over time. Therefore I wanted to implement the login via LDAP for internal users and for external users to register separately.

@pbordon commented on GitHub (May 3, 2021): In my organization, we have internal users, connected to an AD and external users, which are many and vary over time. Therefore I wanted to implement the login via LDAP for internal users and for external users to register separately.
Author
Owner

@ssddanbrown commented on GitHub (Nov 8, 2022):

Updating this to be generic to methods, and merging similar issues into this.

@ssddanbrown commented on GitHub (Nov 8, 2022): Updating this to be generic to methods, and merging similar issues into this.
Author
Owner

@abulgatz commented on GitHub (Feb 5, 2023):

Any plans to add this to your roadmap or implement this? Internal SSO with guest access seems pretty common.

@abulgatz commented on GitHub (Feb 5, 2023): Any plans to add this to your roadmap or implement this? Internal SSO with guest access seems pretty common.
Author
Owner

@ssddanbrown commented on GitHub (Feb 5, 2023):

@abulgatz Probably not anytime too soon, to be totally honest. It's high-risk, low demand, low target audience, high support & maintenance. Therefore it doesn't look worth including at this time.

@ssddanbrown commented on GitHub (Feb 5, 2023): @abulgatz Probably not anytime too soon, to be totally honest. It's high-risk, low demand, low target audience, high support & maintenance. Therefore it doesn't look worth including at this time.
Author
Owner

@Fabsky commented on GitHub (Jul 6, 2023):

I'm in the same case, I mean I've contents for internal users (azure), and content for customers (self register)

@Fabsky commented on GitHub (Jul 6, 2023): I'm in the same case, I mean I've contents for internal users (azure), and content for customers (self register)
Author
Owner

@mfatfhg commented on GitHub (Jul 26, 2023):

Hi, I have opened #4401 and because it was closed, I would like to continue the discussion here.

One of the reasons why we would like to see this features was:

So, I understand that its not a high level feature request on your roadmap. In our opinion, the ability to authenticate with different types of identities (local db users, oidc, ldap) is somethink like industry standard and should be possible.

On of the reasons is the following: Typically, OIDC providers are services in the cloud (if you use SAAS IDPs it might be auth0, or if you self host a IDP, it might be located on a remote site of your company).

If you only allow OIDC at the same time, you cant login to bookstack anymore if you dont have WAN/Internet connectivity anymore. And because we would like to use bookstack as documentation system for emergency manuals too, we would like to have the possibility to login with different types of accounts ( local db accounts or maybe ldap accounts from a local Active directory) as fallback method.

A admin should always have the possibility to access a system in case of technical problems (bad WAN/Internet connectivity).

This was answered by @ssddanbrown with the following argument:

Okay. Could always flip the auth method in an emergency.

This would be like changing the electronic door locks against bearded locks in case of power failure before entering the building.

And changing a config only to access your documentation system is not what you want to do in an emergency situation. And not everyone who need access to the system in such a situation has the ability or possibility to do this.

@mfatfhg commented on GitHub (Jul 26, 2023): Hi, I have opened #4401 and because it was closed, I would like to continue the discussion here. One of the reasons why we would like to see this features was: > So, I understand that its not a high level feature request on your roadmap. In our opinion, the ability to authenticate with different types of identities (local db users, oidc, ldap) is somethink like industry standard and should be possible. > > On of the reasons is the following: Typically, OIDC providers are services in the cloud (if you use SAAS IDPs it might be auth0, or if you self host a IDP, it might be located on a remote site of your company). > > If you only allow OIDC at the same time, you cant login to bookstack anymore if you dont have WAN/Internet connectivity anymore. And because we would like to use bookstack as documentation system for emergency manuals too, we would like to have the possibility to login with different types of accounts ( local db accounts or maybe ldap accounts from a local Active directory) as fallback method. > > A admin should always have the possibility to access a system in case of technical problems (bad WAN/Internet connectivity). This was answered by @ssddanbrown with the following argument: > Okay. Could always flip the auth method in an emergency. This would be like changing the electronic door locks against bearded locks in case of power failure before entering the building. And changing a config only to access your documentation system is not what you want to do in an emergency situation. And not everyone who need access to the system in such a situation has the ability or possibility to do this.
Author
Owner

@ssddanbrown commented on GitHub (Apr 24, 2024):

@GitTH Like this:?

Open image here

image

Third party auth sources work alongside primary auth options, so you may be able to use Azure/Google third party options alongside standard email auth.

@ssddanbrown commented on GitHub (Apr 24, 2024): @GitTH Like this:? <details><summary>Open image here</summary> <p> ![image](https://github.com/BookStackApp/BookStack/assets/8343178/fbbd284e-5c52-42dd-8469-558ca10da0a7) </p> </details> [Third party auth sources](https://www.bookstackapp.com/docs/admin/third-party-auth/) work alongside primary auth options, so you may be able to use Azure/Google third party options alongside standard email auth.
Author
Owner

@simonpa71 commented on GitHub (Apr 29, 2024):

Plus one for this feature request. LDAP may work or not, but I would like to configure a local Admin access anytime. Gitea has this feature, and it makes it easy to configure an admin for mainenance and config, without depending on LDAP, while importing local users with LDPAP. My scenario is simpler than generic mix and match, and could be a starting point.

@simonpa71 commented on GitHub (Apr 29, 2024): Plus one for this feature request. LDAP may work or not, but I would like to configure a local Admin access anytime. Gitea has this feature, and it makes it easy to configure an admin for mainenance and config, without depending on LDAP, while importing local users with LDPAP. My scenario is simpler than generic mix and match, and could be a starting point.
Author
Owner

@CamaroSS commented on GitHub (Jun 10, 2024):

This feature would be very useful. This way we would be able to sign in from our internal system using SAML2 and have external accounts who sign in using email and password.

@CamaroSS commented on GitHub (Jun 10, 2024): This feature would be very useful. This way we would be able to sign in from our internal system using SAML2 and have external accounts who sign in using email and password.
Author
Owner

@eoli3n commented on GitHub (Oct 29, 2024):

https://github.com/BookStackApp/BookStack/issues/5296

@eoli3n commented on GitHub (Oct 29, 2024): https://github.com/BookStackApp/BookStack/issues/5296
Author
Owner

@eoli3n commented on GitHub (Oct 29, 2024):

@abulgatz Probably not anytime too soon, to be totally honest. It's high-risk, low demand, low target audience, high support & maintenance. Therefore it doesn't look worth including at this time.

I strongly disagree, this should be default to be honest. Isn't it as simple as to put a checkbox to be able to trigger local authentication for the current session ?

I worked around this, by moving the admin account as a ldap one, problem is if my AD is down, i'm locked out.

@eoli3n commented on GitHub (Oct 29, 2024): > @abulgatz Probably not anytime too soon, to be totally honest. It's high-risk, low demand, low target audience, high support & maintenance. Therefore it doesn't look worth including at this time. I strongly disagree, this should be default to be honest. Isn't it as simple as to put a checkbox to be able to trigger local authentication for the current session ? I worked around this, by moving the admin account as a ldap one, problem is if my AD is down, i'm locked out.
Author
Owner

@chunter-ccps commented on GitHub (Feb 18, 2025):

+1 to this request. It is very common for a business to have SAML or LDAP accounts for employees and have email/password based signup for customer accounts.

@chunter-ccps commented on GitHub (Feb 18, 2025): +1 to this request. It is very common for a business to have SAML or LDAP accounts for employees and have email/password based signup for customer accounts.
Author
Owner

@schlupmann commented on GitHub (Mar 25, 2025):

Since we needed backend SOAP logout functionality for BookStack, I replaced the OneLogin SAML plugin with SimpleSAMLphp. The main changes involved rewriting Saml2Controller.php and Saml2Service.php, as well as adding configuration files to the app/Config directory. The integration now works as intended with the latest SimpleSAMLphp library (LGPL-licensed) installed in the vendor folder.

This to say that we have been using SimpleSAMLphp with two different identity providers: a local LDAP (with SimpleSAMLphp acting as the IDP) and a French national education SAML ID provider. Both are running seamlessly together for Moodle and ResourceSpace. The same can be set up for Bookstack as well. SimpleSAMLphp supports multiple IDPs and SPs.

If Dan sees value in this and there’s a need for it, I’m happy to clean up the code and provide it.

Also, many thanks to Dan for creating this awesome software!

@schlupmann commented on GitHub (Mar 25, 2025): Since we needed backend SOAP logout functionality for BookStack, I replaced the OneLogin SAML plugin with SimpleSAMLphp. The main changes involved rewriting Saml2Controller.php and Saml2Service.php, as well as adding configuration files to the app/Config directory. The integration now works as intended with the latest SimpleSAMLphp library (LGPL-licensed) installed in the vendor folder. This to say that we have been using SimpleSAMLphp with two different identity providers: a local LDAP (with SimpleSAMLphp acting as the IDP) and a French national education SAML ID provider. Both are running seamlessly together for Moodle and ResourceSpace. The same can be set up for Bookstack as well. SimpleSAMLphp supports multiple IDPs and SPs. If Dan sees value in this and there’s a need for it, I’m happy to clean up the code and provide it. Also, many thanks to Dan for creating this awesome software!
Author
Owner

@timhallmann commented on GitHub (Mar 28, 2025):

Hello @schlupmann, thank you for mentioning your setup! I'm certainly interested in seeing how it works. If you're comfortable publishing the current version, I'd also be happy to take a look at the code as-is.

@timhallmann commented on GitHub (Mar 28, 2025): Hello @schlupmann, thank you for mentioning your setup! I'm certainly interested in seeing how it works. If you're comfortable publishing the current version, I'd also be happy to take a look at the code as-is.
Author
Owner

@schlupmann commented on GitHub (Mar 28, 2025):

@timhallmann,

You can have a look at the SOAP / backend logout with saml2 for Bookstack here : [BookStack_saml2_SOAP](https://github.com/BookStackApp/BookStack/compare/development...schlupmann:BookStack_saml2_SOAP:development)

This is not a cleaned-up version, and the integration with BookStack's SAML2 configuration is quite limited. I prefer working directly with SimpleSAMLphp's configuration, which I’ve set up in the added /app/Config/simplesamlphp folder. However, if there's interest, it wouldn't be too difficult to migrate most standard configuration settings into the /app/Config/saml2.php file and eliminate the "dirty" autoloading of the SimpleSAMLphp library.

To set up SimpleSAMLphp, please refer to the official documentation. The main steps are as follows:

  1. Download the SimpleSAMLphp library to the vendor folder in BookStack.
    
  2. In your server’s host file, point to the appropriate directories:
    - Set the SIMPLESAMLPHP_CONFIG_DIR environment variable to /app/Config/simplesamlphp/config (this ensures the config directory is separate from the library).
    
    • Create an alias for SimpleSAMLphp's public directory: Alias /simplesaml /vendor/simplesamlphp/public
  3. Now, configure your config and authsources files in the config folder, and set up the saml2-idp-remote.php file in the metadata folder (you’ll need to specify the path to this metadata folder in the configuration).

Short explanation of backend logout flow :

  1. Routes Configuration: Web routes in bookstacks routes/web.php define SAML endpoints that receive IdP logout requests and direct them to Saml2Controller

  2. Saml2Controller.php:

  • Exposes /saml2/sls endpoint that receives logout requests
  • Calls Saml2Service::handleSingleLogout() to process requests
  • Provides the static logoutFromIdpBackChannel() method that SimpleSAMLphp calls
  1. Saml2Service.php:
    Houses main back-channel logout logic in handleSingleLogout():
  • Detects if request is front-channel or back-channel
  • For back-channel requests, extracts nameID/sessionIndex from SAML message
  • Queries the database to find corresponding SAML session
  • Registers our logout handler and stores sessionID in static property

Implements logoutFromIdpBackChannel() method which:

  • Retrieves BookStack session ID from stored SAML session data
  • Deletes SAML session from SQL store
  • Directly removes matching BookStack session from database
  • Resets user remember tokens
@schlupmann commented on GitHub (Mar 28, 2025): @timhallmann, You can have a look at the SOAP / backend logout with saml2 for Bookstack here : [[BookStack_saml2_SOAP](https://github.com/schlupmann/BookStack_saml2_SOAP)](https://github.com/BookStackApp/BookStack/compare/development...schlupmann:BookStack_saml2_SOAP:development) This is not a cleaned-up version, and the integration with BookStack's SAML2 configuration is quite limited. I prefer working directly with SimpleSAMLphp's configuration, which I’ve set up in the added /app/Config/simplesamlphp folder. However, if there's interest, it wouldn't be too difficult to migrate most standard configuration settings into the /app/Config/saml2.php file and eliminate the "dirty" autoloading of the SimpleSAMLphp library. To set up SimpleSAMLphp, please refer to the official documentation. The main steps are as follows: 1. Download the SimpleSAMLphp library to the vendor folder in BookStack. 2. In your server’s host file, point to the appropriate directories: - Set the SIMPLESAMLPHP_CONFIG_DIR environment variable to /app/Config/simplesamlphp/config (this ensures the config directory is separate from the library). - Create an alias for SimpleSAMLphp's public directory: Alias /simplesaml /vendor/simplesamlphp/public 3. Now, configure your config and authsources files in the config folder, and set up the saml2-idp-remote.php file in the metadata folder (you’ll need to specify the path to this metadata folder in the configuration). Short explanation of backend logout flow : 1. Routes Configuration: Web routes in bookstacks routes/web.php define SAML endpoints that receive IdP logout requests and direct them to Saml2Controller 2. Saml2Controller.php: - Exposes /saml2/sls endpoint that receives logout requests - Calls Saml2Service::handleSingleLogout() to process requests - Provides the static logoutFromIdpBackChannel() method that SimpleSAMLphp calls 3. Saml2Service.php: Houses main back-channel logout logic in handleSingleLogout(): - Detects if request is front-channel or back-channel - For back-channel requests, extracts nameID/sessionIndex from SAML message - Queries the database to find corresponding SAML session - Registers our logout handler and stores sessionID in static property Implements logoutFromIdpBackChannel() method which: - Retrieves BookStack session ID from stored SAML session data - Deletes SAML session from SQL store - Directly removes matching BookStack session from database - Resets user remember tokens
Author
Owner

@timhallmann commented on GitHub (Mar 31, 2025):

It's not relevant to this issue, but here is a link to my OIDC extension based on the work by @schlupmann -- thanks again!

@timhallmann commented on GitHub (Mar 31, 2025): It's not relevant to this issue, but [here](https://github.com/BookStackApp/BookStack/issues/5279#issuecomment-2767230823) is a link to my OIDC extension based on the work by @schlupmann -- thanks again!
Author
Owner

@voxain commented on GitHub (Jul 16, 2025):

+1 on this. We want to use BookStack alongside our emergency documentation system for documentation. In case everything comes crashing down, it'd be handy to at least have a universal admin login or token that always works, just in case, preferrably without changing the login method in the config.

@voxain commented on GitHub (Jul 16, 2025): +1 on this. We want to use BookStack alongside our emergency documentation system for documentation. In case everything comes crashing down, it'd be handy to at least have a universal admin login or token that always works, just in case, preferrably without changing the login method in the config.
Author
Owner

@kilian-goetz commented on GitHub (Jul 31, 2025):

Greetings,

I agree with this feature. We need two authentication methods at the same time: OIDC (for users) and classic authentication for the administration account, as well as a backup system in case the OIDC provider is down.

@kilian-goetz commented on GitHub (Jul 31, 2025): Greetings, I agree with this feature. We need two authentication methods at the same time: OIDC (for users) and classic authentication for the administration account, as well as a backup system in case the OIDC provider is down.
Author
Owner

@bwint commented on GitHub (Dec 3, 2025):

+1 for this feature.
Would be great to be able to use standard/local authentication as backup in case the primary authentication provider is down.

@bwint commented on GitHub (Dec 3, 2025): +1 for this feature. Would be great to be able to use standard/local authentication as backup in case the primary authentication provider is down.
Author
Owner

@swtgmxat commented on GitHub (Dec 3, 2025):

Also +1 very important feature to have two LOGIN methods in parallel. E.g. LDAP is down, local admin should still work. Also for permission testing very helpful to have a local test user. all the best

@swtgmxat commented on GitHub (Dec 3, 2025): Also +1 very important feature to have two LOGIN methods in parallel. E.g. LDAP is down, local admin should still work. Also for permission testing very helpful to have a local test user. all the best
Author
Owner

@eoli3n commented on GitHub (Dec 3, 2025):

+10, this should be in top priority tier

@eoli3n commented on GitHub (Dec 3, 2025): +10, this should be in top priority tier
Author
Owner

@holger-dev commented on GitHub (Feb 2, 2026):

+10

@holger-dev commented on GitHub (Feb 2, 2026): +10
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2224