Closed SoarinFerret closed 2 years ago
I was recently reached out to for help with this, I figured I would update this issue. I actually have gotten this configuration working without using SLS. More details can be found here: https://blog.kanto.cloud/bookstack-adfs-setup/
The gist of of it is choosing to manually define your parameters for ADFS instead of using the autoload from the federation metadata. This prevents Bookstack from automatically trying to use SLS. Here is the relevant .env
for my ADFS SAML config:
## SAML Config
AUTH_METHOD=saml2
SAML2_NAME=ADFS
SAML2_EMAIL_ATTRIBUTE=mail
SAML2_EXTERNAL_ID_ATTRIBUTE=http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn
SAML2_DISPLAY_NAME_ATTRIBUTES=displayName
## Important - do not set set do the FederationMetadata URL
SAML2_IDP_ENTITYID=http://sts.example.com/adfs/services/trust
## Important
SAML2_AUTOLOAD_METADATA=false
SAML2_IDP_SSO=https://sts.example.com/adfs/ls/
## Important, make sure the following is commented out
#SAML2_IDP_SLO=null
## This is just your signing certificate on ADFS
SAML2_IDP_x509="MIIC2...."
I still have intentions of one day finishing my other patch, because SLS is cool, but it is not a necessity for me at the moment.
I do have a similar issue with Lemonldap::NG as SAML IDP. SLO can't work because the the NameID isn't correct. Lemonldap::NG can't make sense of the request so respond with a code 400
The issue is in this part of the code: https://github.com/BookStackApp/BookStack/blob/65ddd16532e0329cc862f069064181593ad83253/app/Auth/Access/Saml2Service.php#L60
The logout method should be called with correct arguments, see https://github.com/onelogin/php-saml#initiate-slo
At least the correct NameID and SessionIndex that should be registered in user session when he authenticates.
Is there a solution?
As per #2902 a range of changes have now been made for BookStack v21.10.
The new SAML2_SP_x509
and SAML2_SP_x509_KEY
options, which enable SP SLS signing, can be seen in the updated documentation:
https://www.bookstackapp.com/docs/admin/saml2-auth/
Will therefore close this off but please open a new issue if there are problems with the updated implementation.
Describe the bug I believe I have uncovered two issues when setting up SAML with ADFS, not sure if I need to supply multiple bug reports or not.
1) ADFS requires both requests and responses for SLS to be signed by the SP. I was able to get around this by updating the saml config file located in
app/config/saml2.php
and providing the certificate as an environment variable.2) The probably bigger issue is that the SLS request sent to ADFS does not seem to make much sense. The nameid format should be returned the same as Bookstack requests it, which is
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
. However, Bookstack is sending backurn:oasis:names:tc:SAML:2.0:nameid-format:entity
. In addition, the NameID should be my UPN / E-Mail address, but instead it appears to be sending an ADFS URL.Here is the sample response:
Here is the error generated on ADFS after receiving that:
Steps To Reproduce Steps to reproduce the behavior:
Expected behavior I believe I should be expecting 2 things:
Your Configuration (please complete the following information):
Additional context Add any other context about the problem here.
Here is my
.env
relevant SAML config:And here are my ADFS claims rules: