Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: generic SAML setup - "error": "SAML authorization failed, mandatory email attribute not found: map[]" #373

Open
HG00 opened this issue Jan 20, 2025 · 0 comments
Assignees
Labels
need triage question Further information is requested

Comments

@HG00
Copy link

HG00 commented Jan 20, 2025

Caddy v2.9.1 downloaded from caddyserver, adding caddy-security module

Hi, I'm trying to set up very simple SAML authentication (dont care about authorization at the moment, if you can authenticate you're in). I go to /whoami, and as expected get a redirect to /login.

When I auth at the IdP (cyberark), i can see the right stuff come back using saml tracer, but I get an "unauthorized" error, with this in the log:
WARN security Authentication failed {"session_id": "ewpdEUJ4qEOBRgMVYAUDJddHjVTQQ1rQR8Mnmg5agrJ", "request_id": "0fe85434-3cff-4632-9e76-9d8a3e006230", "error": "SAML authorization failed, mandatory email attribute not found: map[]"}

I'm a bit lost at this point - I've tried to add attributes, and verify they're in the claim: email, Email, emailaddress, mail. Even with all of them, the same error persists.

The docs on SAML are a bit sparse, I just tried to edit the example config for jumpcloud - am I missing something else thats needed for a simple SAML login?

If its helpful, here's my masked Caddyfile

{
        debug
        http_port 8088

        order authenticate before respond
        #order authorize before basicauth

        security {
                saml identity provider myrealm {
                        realm myrealm
                        driver generic
                        idp_metadata_location {env.HOME}/.local/caddy/idpmetadata.xml
                        idp_sign_cert_location {env.HOME}/.local/caddy/idpcert.pem
                        idp_login_url https://blabla.my.idaptive.app/applogin/appKey/MASKEDMASKEDMASKED/customerId/ABC123
                        application_name "SAML"
                        entity_id "MASKEDMASKEDMASKED"
                        acs_url https://192.168.1.1:8443/saml/myrealm
                }

                authentication portal myportal {
                        crypto default token lifetime 3600
                        crypto key sign-verify {env.JWT_SHARED_KEY}
                        enable identity provider myrealm
                        cookie domain myrealm.com
                        ui {
                                links {
                                        "Main Site" https://192.168.1.1:8443/ icon "las la-star"
                                        "My Identity" "/whoami" icon "las la-user"
                                }
                        }
                        transform user {
                                match realm myrealm
                                action add role authp/user
                        }
                }

                authorization policy mypolicy {
                        set auth url https://192.168.1.1:8443/saml/myrealm
                        set user identity Subject
                        allow any log debug
                }
        }
}

(tls_config) {
        tls {$HOME}/.local/caddy/server.crt {$HOME}/.local/caddy/server.key
}

192.168.1.1:8443 {
        import tls_config
        authenticate with myportal
}
@HG00 HG00 added need triage question Further information is requested labels Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need triage question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants