Add new properties to the SAML request

Is there any way to add new properties to the saml request that it’s sent to one External Identity Provider?


I’ve done this before by implementing the ProtocolMapper SPI.

For example, you can extend AbstractSAMLProtocolMapper and implement SAMLLoginResponseMapper, and then add your desired properties by changing the SAML inside the transformLoginResponse method.

But this only can be done inside Keycloak, no? Not under any configuration file or xsd scheme?

I don’t believe you can do it using configuration or xsd. The method I suggested requires you to write and install an extension to keycloak.

Thanks a lot, for your reply. Is there any documentation to create one extension for keycloak?

I don’t see clear in this page, server_development, how can I create one extension to modify the saml_request… Can anyone explain me this documentation…

For some reason it won’t let me paste the link properly. Try this ^^^ one.

Ok, i have create a new Identity Provider from SAML, i have added a new field in the html page, where should be defined to sabe properly the new instance with this new field? Now i have one error, unrecognized field.

I have added the field providerName, in the realm theme, new one, and when I try to save I have this error:

Unrecognized field “providerName” (class org.keycloak.representations.idm.IdentityProviderRepresentation), not marked as ignorable

How can I solve this?